Issue
I'm sure I'm overlooking something in the Settings
class documentation. What Intent
can open the Settings app in the "Do not disturb" section?
I expected it to be the ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS
action, but that is only for the screen which lists which apps have requested DND access.
Solution
Update
Looking at the AndroidManifest.xml
for the Settings app there is an Activity
Settings$ZenModeSettingsActivity
already from Android 5.0.
To send the user to the "Do not disturb" screen you can use the action android.settings.ZEN_MODE_SETTINGS
like this:
try {
startActivity(new Intent("android.settings.ZEN_MODE_SETTINGS"));
} catch (ActivityNotFoundException e) {
// TODO: Handle activity not found
}
Original answer
It looks like there are no screens in the Settings app (at least on Android 6+7) where you can enable/disable DND. It seems like this is only available through the settings tile (and can be disabled in the dialog when changing the volume).
I have a Samsung S6 (Android 6.0.1) which has this screen, but this is probably some custom Samsung changes. The screen is represented by the class com.android.settings.Settings$ZenModeDNDSettingsActivity
which can be started by any app. This might be of help for some people out there.
AndroidManifest.xml
for Settings app for Android 6+7:
- https://android.googlesource.com/platform/packages/apps/Settings/+/android-6.0.1_r68/AndroidManifest.xml
- https://android.googlesource.com/platform/packages/apps/Settings/+/android-7.0.0_r6/AndroidManifest.xml
Answered By - Roy Solberg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.