用户登录
用户注册

分享至

如何在 Android 设备上的 ionic2 中获取 IMEI

  • 作者: Heiy
  • 来源: 51数据库
  • 2022-12-30

问题描述

我正在尝试在 ionic 2 中获取 android 设备的 imei,但到目前为止还没有运气.

I am trying to obtain the imei of an android device in ionic 2, but so far no luck.

在 ionic 1 中,我只使用了一个 ngCordova 插件,例如 cordova-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 的 ionic-native 插件,或者是否有任何其他方法可以获取 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

cordova plugin add 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);
    });
  }
软件
前端设计
程序设计
Java相关