简体   繁体   English

如何在ionic 2移动应用程序中获取IMEI号?

[英]how to get IMEI number in ionic 2 mobile app?

I am building a mobile application and want to access the IMEI number. 我正在构建一个移动应用程序,并想访问IMEI号码。

I have gone through the following plugins. 我已经通过以下插件。

  1. https://github.com/vliesaputra/DeviceInformationPlugin https://github.com/vliesaputra/DeviceInformationPlugin
  2. https://github.com/hygieiasoft/cordova-plugin-uid https://github.com/hygieiasoft/cordova-plugin-uid
  3. https://github.com/aquto/cordova-plugin-imei https://github.com/aquto/cordova-plugin-imei

And all of them are giving me 404 error. 所有这些都给我404错误。

Finally I got one plugin that I could install 终于我有了一个可以安装的插件

  1. https://www.npmjs.com/package/imeiplugin https://www.npmjs.com/package/imeiplugin

and below is the code I wrote to access the IMEI 以下是我编写的用于访问IMEI的代码

The below code is written inside my home constructor. 下面的代码写在我的家庭构造函数中。

platform.ready().then(() => {
            window["plugins"].imeiplugin.getImei(function (imei) {
                console.log(imei);
            });
        });

But the control never goes to the console.log(); 但是控件永远不会进入console.log();。

Am I doing anything wrong here?? 我在这里做错什么了吗?

Or if anyone has integrated the IMEI number with some other method please let me know. 或者,如果有人将IMEI号码与其他方法集成在一起,请告诉我。

Or as per suggested in the below link do I have to build my own custom plugin?? 还是按照以下链接中的建议,我必须构建自己的自定义插件?

  1. How to get IMEI number in PhoneGap? 如何在PhoneGap中获取IMEI号码?

I am stuck here and I am looking for an efficient way any help is appreciated. 我被困在这里,我正在寻找一种有效的方式来感谢任何帮助。

Thanks in advance 提前致谢

Actually this plugin works: https://github.com/hygieiasoft/cordova-plugin-uid 实际上,此插件有效: https : //github.com/hygieiasoft/cordova-plugin-uid

(Using: cordova plugin add org.hygieiasoft.cordova.uid returns 404) (使用:cordova插件添加org.hygieiasoft.cordova.uid 返回404)

So try this instead: cordova plugin add https://github.com/hygieiasoft/cordova-plugin-uid 因此,请尝试以下操作: cordova plugin add https://github.com/hygieiasoft/cordova-plugin-uid

platform.ready().then(() => {
   alert(cordova.plugins.uid.IMEI);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM