Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 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 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...