Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Last active May 15, 2018 10:36
Show Gist options
  • 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