Example usage for android.provider Settings ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS

List of usage examples for android.provider Settings ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS

Introduction

In this page you can find the example usage for android.provider Settings ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS.

Prototype

String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS

To view the source code for android.provider Settings ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS.

Click Source Link

Document

Activity Action: Show Do Not Disturb access settings.

Usage

From source file:tm.android.chronos.activity.Chronos.java

private void checkZenModeAccess() {
    Couple<Boolean, Integer> result = Permissions.Instance().checkZenModeAccess(this);
    if (!result.getKey()) { // acces not granted, present system setting to user.
        // no access to do not disturb settings, request !
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            Intent intent = new Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
            startActivityForResult(intent, 0);
        } // bellow version M it is transparently granted.
    }/*from  ww w. j av a2s . com*/
}