简体   繁体   中英

Add action to background of a Notification

On Android Lollipop, the apps have a "background" option when long pressing them.

Normally this gives you the option to click on the "Info" icon and proceed to the Android Settings App, where you can disable the notification, set it important or make it sensible.

Now apps like WhatsApp or Inbox have another option (a "cogwheel" icon) to go into the apps own notification preferences. How am I able to achieve this extra action on the background of the notification?

Finally figured out how it works by reading the docs.

Aparently you have to add an intent filter to the activity in the manifest:

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
        </intent-filter>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM