uniapp获取安卓与ios的唯一标识
uniapp获取安卓与ios的唯一标识
代码如下:
const info = uni.getSystemInfoSync();
const platform = info.platform; // 手机安卓还是苹果
if (info.platform === 'ios') {
// ios
console.log('iOS 设备唯一标识:', info.deviceId);
} else{
//安卓
console.log('系统信息:', userAgent); oaid
console.log('设备信息ID:',info.deviceId);
}
// const iosApp = info.platform;
console.log('iOS 设备名称:', info.model);
console.log('iOS 系统版本:', info.system);
console.log('iOS 设备唯一标识:', info.deviceId);
console.log('iOS 设备像素比:', info.devicePixelRatio);
console.log('iOS 设备屏幕宽度:', info.screenWidth);
console.log('iOS 设备屏幕高度:', info.screenHeight);
console.log('iOS 设备方向:', info.deviceOrientation);
uni.showModal({
title: '提示',
content: info.deviceId,
success(res) {
if (res.confirm) {
console.log('用户点击了确定');
} else if (res.cancel) {
console.log('用户点击了取消');
}
}
});