Can not get work cordova permissions plugin


#1

I added cordova-plugin-android-permissions as told in this page but I cant get it work.
https://github.com/NeoLSN/cordova-plugin-android-permissions.

and in main.js I added this piece of code but I am not sure about it…
I do not see any permission when I run the apk on the device

document.addEventListener('deviceready', function() {

  var permissions = cordova.plugins.permissions;
  permissions.requestPermission(permissions.CAMERA, success, error);

  function error() {
    console.warn('Camera permission is not turned on');
  }

  function success( status ) {
    if( !status.hasPermission ) error();
  }
  console.log('cordova.plugins.permissions is now available');
});

I am not sure but maybe installing plugin is not enough ? Do I need to add permission lines in manifest file but which one ? I see many of them when I search for AndroidManifest.xml, can you help me for this ?


Check If Device Is Ready
#2

permissions can only be tested on a real phone and I am not able to test when apk is on a phone, I know its possible with some way, but in my case I have not running npm run dev

so How can I debug permission plugin for my application, how can I know if at least it fall into addEventListener ?