Q:

Android - when ever my app is installed, by default "No permission allowed" is set?

My app when-ever is installed via Google Play or USB 
(which use microphone, camera just like all other general app), by default the app gets "No permission allowed".
As a result it never works after the installation as fresh install. 
Unless someone manually go in the app settings and change it.

What am i doing wrong? why its causing default into permission denied mode?
AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />

EDIT:
C:\cordova\tpt>cordova plugin add cordova.plugins.diagnostic
Fetching plugin "cordova.plugins.diagnostic" via npm
Installing "cordova.plugins.diagnostic" for android
ANDROID_HOME=C:\Users\tpt\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
null
org.xwalk:xwalk_core_library:23+
Incremental java compilation is an incubating feature.
:clean FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':clean'.
> Unable to delete directory: C:\cordova\tpt\platforms\android\build\outputs\apk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.83 secs
Failed to install 'cordova.plugins.diagnostic':Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (C:\cordova\tpt\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: cmd: Command failed with exit code 1

A:

You need to set permissions for Marshmallow and above devices in code. Plugin provides this capability as well.
Sample reference mentioning the same Even if it is mentioned for ionic, same methodology needs to be used in cordova projects
To get permission status , replicate like following.
cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function (status) {
  console.log(status);
  switch (status) {
    case cordova.plugins.diagnostic.runtimePermissionStatus.GRANTED:
      //call the target method
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.NOT_REQUESTED:
      setPermission();
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED:
      setPermission();
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED_ALWAYS:
      setPermission();
      break;
  }
}, this.errorCallback, cordova.plugins.diagnostic.runtimePermission.ACCESS_COARSE_LOCATION);

And to request authorization
function setPermission() {
  cordova.plugins.diagnostic.requestLocationAuthorization(function (status) {
    switch (status) {
      case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
        break;
      case cordova.plugins.diagnostic.permissionStatus.DENIED:
        break;
      case cordova.plugins.diagnostic.permissionStatus.GRANTED:
        //TODO : Call native plugin.
        break;
      case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
        break;
    }
  }, function (error) { }, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS);
}

