Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
368 views
in Technique[技术] by (71.8m points)

android - How to add a notification settings activity to the system settings

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:
enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

For more information, refer to the Settings app and specifically the NotificationAppList and AppNotificationSettings fragments.

Results

example


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...