![](/img/trans.png)
[英]Titanium Android Notification perform action when user clicks notification
[英]Perform an action when a notification is canceled by the system or anything else but the user
当系统(通过关闭或重新启动)或除用户以外的其他任何东西取消通知时,是否有办法执行操作?
如果是这样,怎么办? 或如何实现onNotificationRemoved ?
您是否尝试过NotificationListenerService ?
当发布或删除新通知或更改其排名时,该服务会接收来自系统的呼叫。
要扩展此类,您必须使用BIND_NOTIFICATION_LISTENER_SERVICE权限在清单文件中声明服务,并在SERVICE_INTERFACE操作中包含意图过滤器。
<service android:name=".NotificationListener"
android:label="@string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
现在,在您的Notification Listner类中,实现onNotificationRemoved
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.