cordova-plugin-sms
cordova-plugin-sms copied to clipboard
Permission Denial
permissions error on android 6.0.1
error list sms: Permission Denial: reading com.android.providers.telephony.SmsProvider uri content ://sms/inbox requires android.permission.READ_SMS , or grantUriPermission()
@manufuentescr Same here. Have you fixed it yet?
It would be nice to know if this plugin will be updated to handle changes in the latest Android versions and if that is the case when that updated plugin will be released.
Quick fix from http://stackoverflow.com/questions/37803513/android-6-permission-denied-for-reading-sms
Install cordova-plugin-android-permissions
cordova plugin add cordova-plugin-android-permissions
function checkPermissionCallback(status) {
if (!status.hasPermission) {
var errorCallback = function () {
console.log('no sms permisions');
ionic.Platform.exitApp();
}
permissions.requestPermission(permissions.READ_SMS, function (status) {
if (!status.hasPermission) errorCallback();
}, errorCallback);
}
}
var permissions = window.plugins.permissions;
permissions.hasPermission(permissions.READ_SMS, checkPermissionCallback, null);
I am not using Ionic . Working at Cordova .But Not working. Any Possible way to Declare device Ready function to Set a Permission to Read the SMS in Cordova