I would like to launch the phone's notification settings for my Android app(Oreo version) from a PreferenceScreen. I am using below in preferences.xml file. However, it does not work. Does anyone have an idea?
<PreferenceScreen
android:title="@string/Notification">
<intent android:action="android.settings.APP_NOTIFICATION_SETTINGS"
android:data="package:com.my_app_package_name" />
</PreferenceScreen>
For Android 5-7: You have to call start activity from code (programmatically) because there is no way to determine uid of the app in Layout file
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", getPackageName());
intent.putExtra("app_uid", getApplicationInfo().uid);
For Android O up:
<intent android:action="android.settings.APP_NOTIFICATION_SETTINGS">
<extra android:name="android.provider.extra.APP_PACKAGE" android:value="your app package name" />
</intent>