I'm trying to follow the Material Design Guidelines on how to "Link your app's settings to Android channel settings". As the images shows, there should be a button on the app-settings "Additional settings in the app" but I don't know how to set this up.
https://material.io/guidelines/patterns/notifications.html#notifications-settings
I'd expect the NotificationChannel
to have an option to set the correct intent or an intent-filter but I cannot find any option for that.
There has been similar behaviors for managing the network and I thought this would work the same way?!
Does anyone knows how to implement this?
To create a notification channel, follow these steps: Construct a NotificationChannel object with a unique channel ID, a user-visible name, and an importance level. Optionally, specify the description that the user sees in the system settings with setDescription() .
Starting with Android 8.0, apps are required to assign their notifications to so-called “notification channels”. These channels determine which signals (notification sound, light, vibration, etc.) incoming notifications trigger.
Silent: Your phone won't make a sound or vibrate. But the notification will show up when you swipe down from the top of your screen.
You just need to add the following intent filter to your settings activity in the manifest:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
</intent-filter>
This intent was added in API 21. It added a cog icon to the app's notification page in the system settings. Clicking on the icon would take the user to the app's settings activity.
The only change in Api 26 is that now it appears as 'Additional settings in the app' instead of an icon.
in case you want to open settings fragment just check intent of your activity:
intent.getCategories().contains("android.intent.category.NOTIFICATION_PREFERENCES")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With