Android的 - DeleteIntent,如何使用? [英] Android - DeleteIntent, how to use?

查看:234
本文介绍了Android的 - DeleteIntent,如何使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有我的Andr​​oid应用程序的通知,有一个PendingIntent,以便它被点击时的活动被打开。

I currently have a notification in my Android application that has a PendingIntent so that when it is clicked an activity is opened.

我目前保持的计数器的通知,类似于天然的未接呼叫的通知。

I currently keep a counter for the notification, similar to the native missed calls notification.

我可以重新设置该计数器为0,该通知被点击时。

I can reset this counter to 0 when the notification is clicked.

我还希望当用户选择了清除所有通知按钮,计数器复位到0。我做了一个搜索,看到要做到这一点是使用DeleteIntent的方式。

I also want to reset the counter to 0 when the user selects the "Clear all notifications" button. I have done a search and seen the way to do this is to use the DeleteIntent.

不过,我无法弄清楚如何使用这个我一起PendingIntent,谁能帮助我?

But I cant figure out how to use this alongside my PendingIntent, can anyone help me out?

推荐答案

创建广播或服务 PendingIntent ,指向的BroadcastReceiver IntentService ,将重置计数器,并且>联营的 PendingIntent 通知通过 deleteIntent

Create a broadcast or service PendingIntent, pointing to a BroadcastReceiver or IntentService that will reset your counter, and associate that PendingIntent with your Notification via deleteIntent.

这篇关于Android的 - DeleteIntent,如何使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆