Example usage for android.provider Settings ACTION_APP_NOTIFICATION_SETTINGS

List of usage examples for android.provider Settings ACTION_APP_NOTIFICATION_SETTINGS

Introduction

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

Prototype

String ACTION_APP_NOTIFICATION_SETTINGS

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

Click Source Link

Document

Activity Action: Show notification settings for a single app.

Usage

From source file:com.sxt.chat.activity.NotifycationActivity.java

/**
 * ?app?/*from  w w w .  j a v  a  2 s  .co m*/
 */
public void goToNotificationSettings() {
    Intent intent = new Intent();
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
        intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
        intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName());
    } else {
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + getPackageName()));
    }
    startActivity(intent);
}