简体   繁体   English

用户单击通知后的时间间隔后如何取消通知?

[英]how to cancel notification after time interval when user clicks on notification?

I have developed an app, in which I implemented notification service. 我开发了一个应用程序,在其中实现了通知服务。 & I fixed time interval for notification (For example, I get notification for some updates but the update validity (ie) expire time is 15 min and after that time interval if user opens the notification then it should not intent to next activity and notification needs to be canceled). &我固定了通知的时间间隔(例如,我收到了一些更新的通知,但更新有效期(即)到期时间为15分钟,在该时间间隔之后,如果用户打开通知,则不应打算进行下一个活动和通知需求被取消)。

In my app while pushing notification I use to send message along with update end time. 在我推送通知的同时,我的应用程序用于发送消息以及更新结束时间。 By using end time how to manage notification without intent to next activity if end time expires 通过使用结束时间,如果结束时间到期,如何在不打算进行下一个活动的情况下管理通知

well if you do your coding and the end time is up, you call this.. 好吧,如果您进行编码并且结束时间到了,您可以将其称为..

NotificationManager notificationManager = (NotificationManager)Context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(id); // the notification id eg 34

are you okay? 你还好吗?

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

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