问题
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.
回答1:
Try using this cordova plugin - https://github.com/diegosiao/cordova-plugin-android-sms-retriever This might solve your issue.
回答2:
You can use below cordova plugin for permission.
https://www.npmjs.com/package/cordova-plugin-android-permissions
来源:https://stackoverflow.com/questions/54235794/cordova-android-app-crashes-on-android-p-due-to-receive-sms-permission-denial