How to grant more permissions to android shell user? How to grant more permissions to android shell user? shell shell

How to grant more permissions to android shell user?


This is the new permissions model in Android Marshmallow in action. To get this permission you'll need to prompt the user to grant it. Here's what I do:

  1. Whenever I need RECORD_AUDIO permission I run a check to see if I have it:

    private boolean hasRecordAudioPermission(){    boolean hasPermission = (ContextCompat.checkSelfPermission(this,        Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED);    log("Has RECORD_AUDIO permission? " + hasPermission);    return hasPermission;}
  2. If I don't have it then request it

    private void requestRecordAudioPermission(){    String requiredPermission = Manifest.permission.RECORD_AUDIO;    // If the user previously denied this permission then show a message explaining why    // this permission is needed    if (ActivityCompat.shouldShowRequestPermissionRationale(this,            requiredPermission)) {        showToast("This app needs to record audio through the microphone....");    }    // request the permission.    ActivityCompat.requestPermissions(this,            new String[]{requiredPermission},            PERMISSIONS_REQUEST_RECORD_AUDIO);}@Overridepublic void onRequestPermissionsResult(int requestCode,                                       String permissions[], int[] grantResults) {    // This method is called when the user responds to the permissions dialog}