How to use cordova-plugin-android-permissions in Ionic 3?

后端 未结 1 452
[愿得一人]
[愿得一人] 2020-12-19 19:13

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 th

相关标签:
1条回答
  • 2020-12-19 19:44

    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.

    0 讨论(0)
提交回复
热议问题