Jonny
Jonny

Reputation: 306

android enable 'settings' permissions

I'm writing some automation testing for my app, On my emulator is there a way to enable settings permissions (permissions that requires the user to go to device settings and enable them) like usage state, accessibility services, notifications from ADB? (like 'adb shell pm grant')

Upvotes: 2

Views: 171

Answers (2)

bkach
bkach

Reputation: 1441

Using adb the closest you could get is opening the Application settings.

adb shell am start -a android.settings.APPLICATION_SETTINGS

Otherwise UIAutomator would be the way to automate this.

Upvotes: 0

Iulian Popescu
Iulian Popescu

Reputation: 2643

You don't have any APIs that can to that, but if you're using UIAutomator it is pretty easy to achieve. If you're using Espresso, you need to add UIAutomator (Espresso is for single app testing, while UiAutomator is cross-app testing) and this will give you the possibility to access the Settings app.

Upvotes: 1

Related Questions