React-Native 使用 react-native-device-info 获取手机型号,上架应用商店被拒绝,读取 AndriodID

解决方法,将 import 导入修改为内联应用

原代码

import DeviceInfo from 'react-native-device-info';


let deviceName = DeviceInfo.getModel(); // 设备型号
let client = DeviceInfo.getSystemVersion(); // 手机系统
let version = DeviceInfo.getVersion(); // app 版本号
let versionCode = DeviceInfo.getBuildNumber(); // app build 版本

修改后

// 内联应用调用设备型号,防止安卓市场拒绝审核
export function getDevice () {
console.log('内联调用 react-native-device-info')
return require('react-native-device-info').default;
}

let DeviceInfo = getDevice()
let deviceName = DeviceInfo.getModel(); // 设备型号
let client = DeviceInfo.getSystemVersion(); // 手机系统
let version = DeviceInfo.getVersion(); // app 版本号
let versionCode = DeviceInfo.getBuildNumber(); // app build 版本



1564
0
1年前