Ionic 3 read SMS plugin for OTP Verification

Ionic 3 read SMS plugin for OTP Verification is not working i don’t know what i am doing wrong below my code

constructor(){
this.checkPermission();
}

Here is my check permission

checkPermission()

  {

    //alert('checkPermissionAndSend');

   this.platform.ready().then(() => {

     

      this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.READ_SMS).then(

        success => {

          //if permission granted

          this.receiveSMS();

        },

      err =>{

        

        this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.READ_SMS).

        then(success=>{

          this.receiveSMS();

        },

      err=>{

        alert("cancelled")

      });

      });

      

      this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.READ_SMS]);

      

   });

}

this is my read message code am using this npm

receiveSMS()

{

  SmsReceiver.startReception(({messageBody, originatingAddress}) => {

    alert(messageBody)

  }, () => {

    alert("Error while receiving messages")

  }) 
}

Please help me out. It will be highly appreciated
Thanks in advance

You don’t need a Permission for the SMS Retriever. It works if you add a specific Code to the Send SMS. I prefer to read the Docs complete first, before asking here.

1 Like

Thanks for your suggestion.i will check

I removed the permission but still its not working.Please can u suggest me how can i do that?