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