How to get IMEI Number in Cordova?

陌路散爱 提交于 2019-12-05 10:30:33

Simplest way to get IMEI in android device only

$ cordova plugin add https://github.com/vliesaputra/DeviceInformationPlugin.git

The above listed is cordova plugin to get device information. get method of that plugin generate a JSON In which you can see your android device’s IMEI number.

Using code:

var deviceInfo = cordova.require("cordova/plugin/DeviceInformation");
deviceInfo.get(
   function(result) {
      console.log("result = " + result);
   },function() {
      console.log("error");
});

Without using code:

  • In device’s hardware where you insert your SIM
  • In device’s Setting->About phone->Status->IMEI OR (SIM status -> IMEI)
  • Dial: *#06#

IMEI number is actually SIM card port number. so you can not access IMEI number of SIM-LESS devices. (ex.:- without SIM tablet)

ceejayoz

You've been linked to how to do it in Android. It is not possible in iOS - Apple does not permitt it. UUID will have to do.

Another cordova plugin not mentioned here is cordova-plugin-imei

https://www.npmjs.com/package/cordova-plugin-imei

Example:

window.plugins.imei.get(
  function(imei) {
    console.log("got imei: " + imei);
  },
  function() {
    console.log("error loading imei");
  }
);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!