简体   繁体   English

将操作添加到通知的背景

[英]Add action to background of a Notification

On Android Lollipop, the apps have a "background" option when long pressing them. 在Android Lollipop上,长按时,应用程序具有“背景”选项。

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. 通常,这使您可以选择单击“信息”图标并进入Android设置应用,在该应用中,您可以禁用通知,将通知设置为重要或使其变得明智。

Now apps like WhatsApp or Inbox have another option (a "cogwheel" icon) to go into the apps own notification preferences. 现在,WhatsApp或Inbox等应用程序具有另一个选项(“齿轮”图标),可以进入应用程序自己的通知首选项。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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