如何在android设备上的ionic2中获取IMEI [英] How to get IMEI in ionic2 on an android device
问题描述
我试图在离子2中获得一个Android设备的imei,但到目前为止还没有运气。
I am trying to obtain the imei of an android device in ionic 2, but so far no luck.
在离子1升中我刚刚使用了像cordova这样的ngCordova插件-uid https://github.com/hygieiasoft/cordova-plugin-uid 。
In ionic 1 l just used an ngCordova plugin like cordova-uid https://github.com/hygieiasoft/cordova-plugin-uid.
我是否可以使用离子本机的插件来获取imei,或者是否有任何其他方式来获取imei。
Is there a plugin for ionic-native that I can use to obtain the imei or is there any other way to get the imei.
推荐答案
可以使用此代码。
cordova插件添加org.hygieiasoft.cordova.uid
cordova plugin add org.hygieiasoft.cordova.uid
或
cordova插件添加 https://github.com/hygieiasoft/cordova -plugin-uid
对于测试用途console.log
For test use console.log
declare var cordova: any;
export class MyApp {
constructor(platform: Platform ) {
platform.ready().then(() => {
console.log(cordova.plugins.uid.IMEI);
});
}
这篇关于如何在android设备上的ionic2中获取IMEI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!