uni-app 在app端内置了HTML5+引擎,可以直接使用H5+的API:https://www.html5plus.org/doc/zh_cn/device.html
因为IMEI、IMSI被废弃,所以HBuilderX2.0.0以后版本使用 plus.device.getInfo。
//获取设备IMEI、IMSI、型号、厂商等
plus.device.getInfo({
success:function(e){
console.log('getDeviceInfo success: '+JSON.stringify(e));
// 双卡手机
const imei = e.imei.split(',');
console.log(imei);
that.imei = imei[0];
},
fail:function(e){
console.log('getDeviceInfo failed: '+JSON.stringify(e));
}
});