title: Cordova App 'Android permission Cordova plugin' is not showing permission dialog
body: <p>i am attending to use 'imagepicker' plugin for my cordova app to get images from the mobile gallery and use them . i am testing my app on android 6.0 device and this is the problem, marshmallow Android 6.0 require in run-time permission not like the older versions "it is working on older versions" ,but on api 23 or higher when it attend to open gallery it close immediately and the app crashes . when i searched i found that i need permission to do it . so i started to use "Android permission Cordova plugin" and by copying the example they presented in this page : <a href="https://www.npmjs.com/package/cordova-plugin-android-permissions" rel="noreferrer">https://www.npmjs.com/package/cordova-plugin-android-permissions</a></p>
  
  <p>which is :</p>
  
  <pre><code>var permissions = cordova.plugins.permissions;
  permissions.hasPermission(permissions.CAMERA, checkPermissionCallback, null);
  
  function checkPermissionCallback(status) {
    if(!status.hasPermission) {
      var errorCallback = function() {
        console.warn('Camera permission is not turned on');
      }
  
      permissions.requestPermission(
        permissions.CAMERA,
        function(status) {
          if(!status.hasPermission) errorCallback();
        },
        errorCallback);
    }
  }
  </code></pre>
  
  <p>the console always says : 'Camera permission is not turned on' and no permission dialog shows.</p>
  
  <p>then i searched again and found this solved question and it`s answer , so i installed 'cordova-plugin-diagnostic' and tried this code:</p>
  
  <pre><code>function requestPermission(){
      cordova.plugins.diagnostic.requestRuntimePermission(function(status){
          switch(status){
              case cordova.plugins.diagnostic.runtimePermissionStatus.GRANTED:
                  console.log("Permission granted (or already granted) - call the plugin");
                  // call SQLite plugin
                  break;
              case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED:
                  console.log("Permission denied - ask again");
                  alert("Come on user, we really need this. I'll ask again...");
                  requestPermission();
                  break;
              case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED_ALWAYS:
                  console.log("Permission permanently denied");
                  alert("Well that's it, we're dead Jim");
                  navigator.app.exitApp();
                  break;
          }
      }, function(error){
          console.error("The following error occurred: "+error);
      }, cordova.plugins.diagnostic.runtimePermission.READ_PHONE_STATE);
  }
  requestPermission();
  </code></pre>
  
  <p>the app close and no dialog shows too, i think i can`t get what should this plugins do and how can i get the permission to open gallery. if can somebody give me full example to open gallery and pick image with permission it will be great help.</p>
  
  <p>sorry for my English , and thanks for being patient .</p>