I really like the new permission system in Android from the end users point of view as I like to have control over what my phone does but I am really struggeling with it at work, here is why:

We are developing apps and I am responsible for the QA and we recently introduced automated tests. During the testing process, we install our app on an Android Emulator (Visual Studio Emulator for Android). As our app needs access to location services, Android asks the user for permission. Since the user is "the king", the permission dialog is not exposed to our testing framework so we can't respond to it automatically and because the tests run at night, there is nobody to respond to that dialog manually.

So here is my question:

Is there any setting in Android to disable the new permission system? There is no need to set this setting automatically, I can set this one setting once by hand, the only thing I can't do is to respond to that permission dialog every time the app is installed.

Thanks for your help, vat

3 Answers 3


adb install -g package.apk

I had a similar issue in automated testing: when launching the app the permission dialog popped up. The adb shell pm grant … command did not help but there is the -g option of adb install to grant all permissions upon install. This solved the problem for me.

From adb --help:

Android Debug Bridge version 1.0.41
Version 30.0.5-6877874
app installation (see also `adb shell cmd package help`):
 install [-lrtsdg] [--instant] PACKAGE
     push a single package to the device and install it
    -g: grant all runtime permissions

You can't disable it completely, and you wouldn't want to do it on your test machine even if you could, because then you wouldn't be able to test how your app interacts with the permission system (e.g. displaying the "permission rationale", handling rejected requests, handling loss of focus when the dialog shows).

This question on Stack Overflow, our sister site for programming questions explains a few ways you can manage Marshmallow's runtime permissions when running tests, and another question on the same site has some different answers. As you've said you're willing to do a one-time action to make it work, don't forget that you can check the "don't ask again" option when you get the permission dialog, to automatically accept future requests for the same permission from the same app.

  • Thanks, Dan, I came over from StackOverflow as I thought this question is more android specific. The answer in the first link helped me out.
    – vatbub
    Jul 4, 2016 at 14:47
  • Well, I thought, this would help me out... While following the instructions I linked in my answre, the Pop up "Do you want to grant ...App GPS access?" does not disappear on the phone
    – vatbub
    Jul 4, 2016 at 15:27

Just for reference: Here is the answer that solved my problem (taken from https://stackoverflow.com/a/32798532/5736633):

You can grant and revoke permissions using:

adb shell pm grant com.package.myapp android.permission.<PERMISSION>
adb shell pm revoke com.package.myapp android.permission.<PERMISSION>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .