2022-10-06 18:00:33 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
## From https://developer.android.com/develop/ui/views/notifications/notification-permission#test
|
|
|
|
|
2024-09-24 20:02:32 +02:00
|
|
|
PACKAGE_NAME=de.spiritcroc.riotx.debug
|
2022-10-06 18:00:33 +02:00
|
|
|
|
|
|
|
# App is newly installed on a device that runs Android 13 or higher:
|
|
|
|
|
|
|
|
adb shell pm revoke ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS
|
|
|
|
adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-set
|
|
|
|
adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-fixed
|
|
|
|
|
|
|
|
# The user keeps notifications enabled when the app is installed on a device that runs 12L or lower,
|
|
|
|
# then the device upgrades to Android 13 or higher:
|
|
|
|
|
|
|
|
# adb shell pm grant ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS
|
|
|
|
# adb shell pm set-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-set
|
|
|
|
# adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-fixed
|
|
|
|
|
|
|
|
# The user manually disables notifications when the app is installed on a device that runs 12L or lower,
|
|
|
|
# then the device upgrades to Android 13 or higher:
|
|
|
|
|
|
|
|
# adb shell pm revoke ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS
|
|
|
|
# adb shell pm set-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-set
|
|
|
|
# adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-fixed
|