Did you asked for permission to write external storage? Android 8 need to have an inline check for permission (not only in manifest) this is why it worked in older android versions because it use permissions from manifest and maybe this plugin dont have requestPermission method, some other plugins have both methods(manifest and Inline requestPermission checker) this is why you never faced this problem with other plugins, to solve this you can use AndroidPermissions, here is how I do it:
import { Injectable } from '@angular/core';
import { AndroidPermissions } from '@ionic-native/android-permissions';
@Injectable()
export class PermissionService {
constructor (private androidPermissions: AndroidPermissions) {
}
requestNecessaryPermissions () {
// Change this array to conform with the permissions you need
let androidPermissionsList = [
this.androidPermissions.PERMISSION.CAMERA,
this.androidPermissions.PERMISSION.ACCESS_FINE_LOCATION,
this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE,
this.androidPermissions.PERMISSION.READ_PHONE_STATE
];
return this.androidPermissions.requestPermissions(androidPermissionsList);
}
}
And in your component, use the service like that
this.permissionService.requestNecessaryPermissions().then(() => {
// open plugin here, after user agreed to permissions
});
Hi killerchip! I am using the Diagnostic plugin and inside the response of the promise i use another plugin to save a base64 string into gallery.
If I switch manually the external storage permission. It works.
Dynamically by the Diagnostic plugin not, but the plugin`s response is “GRANTED”.
Any idea?
Sorry for my English
Apologies but it’s been some time since I touched Ionic, since my latest projects are not related to it :-(.
So I don’t remember much…
But did you check the Cordova’s config.xml (or whatever it is called… can’t remember)? I think you should have requested the access rights there (static request on build), in addition to dynamic rights requested inside your app flow.