如何将通知设置活动添加到系统设置 [英] How to add a notification settings activity to the system settings
问题描述
在Android 5.0上,可以通过Settings -> Sound & notification -> App notification -> Calendar (for example)
选项直接转到应用程序的通知设置.
我也知道这是清单中的标志,如 DEV.BYTES对话所述. br>
如何实现,使用的标志是什么?
On Android 5.0 there is an option through Settings -> Sound & notification -> App notification -> Calendar (for example)
to go directly to the notification settings of the app.
I also know it's a flag in the manifest as described in this DEV.BYTES talk.
How can it be achieved, what is the flag used?
以下是屏幕截图,可用于进一步说明:
Here is a screenshot for more clarification:
推荐答案
You need to add the Intent
category Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES
to the Activity
you'd like to launch through your AndroidManifest
. A simple example would be something like:
<activity android:name="com.example.packagename.YourSettingsActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
</intent-filter>
</activity>
有关更多信息,请参阅设置"应用,尤其是 AppNotificationSettings
片段.
For more information, refer to the Settings app and specifically the NotificationAppList
and AppNotificationSettings
fragments.
结果
这篇关于如何将通知设置活动添加到系统设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!