No Fileentry Results Returned On Android 6
I've got what appears to be a file read permissions issue in my Cordova app, but I can't for the life of me track it down properly. Between Android 5 and Android 6, I'm seeing comp
Solution 1:
Hat tip to @greenapps for the hint -- this behavior is apparently due to the runtime permissions introduced in Android 6.
For Cordova, there's a plugin that can address the issue until cordova-android
is cleaned up a bit (as of 11/6/2017, PhoneGap Build uses cordova-android 6.2.3, which depends on cordova-plugin-compat
to deal with this). My fix for now:
cordova plugin add cordova.plugins.diagnostic
Then the routine to add the appropriate runtime permissions:
// request read access to the external storage if we don't have it
cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(function (status) {
if (status === cordova.plugins.diagnostic.permissionStatus.GRANTED) {
console.log("External storage use is authorized");
} else {
cordova.plugins.diagnostic.requestExternalStorageAuthorization(function (result) {
console.log("Authorization request for external storage use was " + (result === cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied"));
}, function (error) {
console.error(error);
});
}
}, function (error) {
console.error("The following error occurred: " + error);
});
Post a Comment for "No Fileentry Results Returned On Android 6"