Tried calling native plugin, but not found in runtime


I am trying to read Uid.IMEI from Ionic Native Uid plugin. I handled the runtime permission issue for Android 6 using Diagnostic, and then tried to read Uid.IMEI. But it is showing

Native: tried calling Uid.IMEI, but the Uid plugin is not installed.
Install the Uid plugin: 'ionic cordova plugin add'

I have tried removing and then re-installing the plugin. The issue is , this message is shown only after installing the app and then opening it . Later on, I don’t find this msg , rather IMEI is read perfectly .

here is the code snippet…

 getPermission() {

    this.diagnostic.getPermissionAuthorizationStatus(this.diagnostic.permission.READ_PHONE_STATE).then((status) => {
      if (status != this.diagnostic.permissionStatus.GRANTED) {

        this.diagnostic.requestRuntimePermission(this.diagnostic.permission.READ_PHONE_STATE).then((data) => {
          var imei = this.uid.IMEI;
          console.log("in promise imei "+ imei);
      else {
        console.log("We have the permission");
        console.log("IMEI granted ----------"+this.uid.IMEI);

    }, (statusError) => {

After installing the app, the requestRuntimePermission block is executed and after user accepts , Uid plugin tried to read IMEI, here my app does not find the plugin ! After that, I exit the app, reopen it , then see the permission is already granted and IMEI is found.

IMEI granted ----------

I saw some solutions referring to async/await. I am using Ionic framework 2 , and can’t update to Ionic 3 now, since my project is a bit complex. Plz suggest anyone if it can be solved avoiding async/await.


Where are you calling getPermission() from?
If you’re calling it when the app launches, try calling it after the platform is ready, like so


and call it outside the constructor (maybe inside ionViewDidLoad() or so).
Good luck!


I have called it within ionViewDidEnter() and platform.ready , but no luck ! First time after installing app, it is showing same msg,

tried calling Uid.IMEI, but the Uid plugin is not installed

After exiting app, reopening it, then shows the proper imei :frowning:


Looks like something is causing it not to load when the app launches. Is it properly loaded in app.module.ts?