I am using a couple of cordova plugins like camera and Image Pickers in my App and they work great on all the Devices… but the problem comes for getting the Permission to these plugins from the phone. Below Android 6 Versions asks for these permissions while installing but Android 6 and above ask for these permissions only when for the first time when the user uses that plugin inside the application(i.e during the Runtime).
I found this Ionic native plugin to handle these permissions in all versions of Android But exactly not getting how to use it or where to use it in my code, So If anyone has any Videos or know anything about it then please mention it here.
Thanks,
I figured it out how to use this native plugin. this is what I tried.
Installed the Plugin as mentioned in this ionic doc
then in my app.component.ts file
import { AndroidPermissions } from '@ionic-native/android-permissions';
constructor(platform: Platform, androidPermissions: AndroidPermissions) {
platform.ready().then(() => {
androidPermissions.requestPermissions(
[
androidPermissions.PERMISSION.CAMERA,
androidPermissions.PERMISSION.CALL_PHONE,
androidPermissions.PERMISSION.GET_ACCOUNTS,
androidPermissions.PERMISSION.READ_EXTERNAL_STORAGE,
androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE
]
);
})
}
I hope this will help someone. Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With