Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Last active May 15, 2018 10:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitherejoe/a4ac9a2f92a22740f17a to your computer and use it in GitHub Desktop.
Save hitherejoe/a4ac9a2f92a22740f17a to your computer and use it in GitHub Desktop.
private void allowPermissionsIfNeeded() {
if (Build.VERSION.SDK_INT >= 23) {
UiObject allowPermissions = mDevice.findObject(new UiSelector().text("Allow"));
if (allowPermissions.exists()) {
try {
allowPermissions.click();
} catch (UiObjectNotFoundException e) {
Timber.e(e, "There is no permissions dialog to interact with ");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment