Search code examples
androidcordovacordova-pluginsandroid-permissionscrash

Cordova Android app crashes on Android P due to RECEIVE_SMS permission denial


I have a Cordova Android app which works fine on earlier versions of Android OS, but app starts to crash on Android P (9.0), and I am getting the following logs while app launches:

Permission Denial: receiving Intent { act=android.provider.Telephony.SMS_RECEIVED flg=0x19000010 (has extras) } to com.example.myapp requires android.permission.RECEIVE_SMS due to sender com.android.phone    

My app is retrieving SMS for OTP autocomplete and i already added RECEIVE_SMS permission to config file.

It seems we have to migrate to the SMS Retrieval API which is described in this article, but in this case we need a cordova plugin to do so.

I will appreciate if anyone can guide how to fix this issue.


Solution

  • Try using this cordova plugin - https://github.com/diegosiao/cordova-plugin-android-sms-retriever This might solve your issue.