Exposing Notification Settings to the Android System

Have you ever looked at the Android System settings page for a specific application and wondered about the option to view “Additional settings in the app”? If you haven’t seen this before in your settings, or aren’t aware of it, this is what it looks like:

This option allows developers to essentially provide a link to a push notification settings screen in their application — this allows users to quickly and easily continue altering their notification settings for the chosen app directly from the system. The ability to hook into this was added at API level 21 (Android 5.0), but not all applications are making use of the feature.

To add this to your app we simply need to make use of the Notification Preferences Intent Category to define which activity to be launched when this link within the system settings is pressed. By default if our application has not make use of this Intent Category then the option within settings will not be displayed. If you want to display this option within your settings for your users then all you need to do is the following:

<activity android:name=”.PushSettingsActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category
.NOTIFICATION_PREFERENCES” />
</intent-filter>
</activity>

Now, the “Additional settings in the app” option will display on our application notification settings and when clicked, the PushSettingsActivity defined above will be launched.

Note: In some cases application setting screens will require the user to be logged in. Because of this, you may need to add some extra logic to your application to ensure that there is an authenticated user and if not, handling that case accordingly. Whilst the chance of this happening may be slim, it’s a small amount of work to ensure that the user doesn’t end up in a weird state.

--

--

--

Learnings, thoughts and musings from Buffer’s Engineering and Data teams

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joe Birch

Joe Birch

Android Engineering Lead at Buffer, Google Developer Expert for Android & Flutter - Passionate about mobile development and learning. www.joebirch.co

More from Medium

How to Intercepter HTTPS on Android With Requestly SDK

Basics for your first Android App: REST API, Database, and Fragment Navigation

Getting started on Android App Development

TDD — Part III, Hilt and Robolectric (Android)