title: How to get IMEI Number | IONIC | Android
body: <p>I need to fetch the IMEI from Android device, i am working in an IONIC App.</p>
  
  <p>I am using this plugin - <code>ionic cordova plugin add cordova-plugin-uid</code></p>
  
  <p>Reference link - <a href="https://ionicframework.com/docs/native/uid/" rel="nofollow noreferrer">https://ionicframework.com/docs/native/uid/</a></p>
  
  <p>Here is my code snippet - </p>
  
  <pre><code>async getIMEI() {
  
      const {hasPermission} = await this.androidPermissions.checkPermission(
          this.androidPermissions.PERMISSION.READ_PHONE_STATE
      );
  
      console.log("hasPermission : " + hasPermission);
      if (!hasPermission) {
          const result = await this.androidPermissions.requestPermission(
              this.androidPermissions.PERMISSION.READ_PHONE_STATE
          );
  
          if (!result.hasPermission) {
              throw new Error('Permissions required');
          }
  
          // ok, a user gave us permission, we can get him identifiers after restart app
          return 0 ;
      }
  
      return this.uid.IMEI;
  }
  </code></pre>
  
  <p>I am calling getIMEI() in constructor  - </p>
  
  <pre><code> constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController,
                  public apiProvider: ApiProvider, public storage: Storage, public platform: Platform, public fcm: FCM,
                  public uid: Uid, public androidPermissions: AndroidPermissions) {
  
  
          platform.ready().then(() =&gt; {
  
              if (this.platform.is('android')) {
                  console.log("running on Android device!");
                  this.deviceType = 'ANDROID';
                  this.getIMEI();
              }
              if (this.platform.is('ios')) {
                  console.log("running on iOS device!");
                  this.deviceType = 'IPHONE';
              }
  
  
  
          });
      }
  </code></pre>
  
  <p>I am always getting IMEI number as <strong>null</strong> value.</p>