如何在Android上的特定时间后删除通知?

编程入门 行业动态 更新时间:2024-10-21 06:08:35
本文介绍了如何在Android上的特定时间后删除通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建一个简单的Andr​​oid应用程序中创建一个通知。

I am creating an simple android application in that created a notification.

现在我想删除通知,如果用户没有在特定的时间后,响应

Now i want to remove the notification if the user doesn't response after the particular time

这意味着我想经过五分钟删除通知

That means i want remove the notification after five mins

推荐答案

您需要的是Alarmmanager和notificationmanger的组合。

What you need is a combination of Alarmmanager and notificationmanger.

注册报警管理器,将在5分钟内调用服务,并在服务实现使用NotificationManager.cancel。

Register the alarm manager that will call a service in 5 minutes and use NotificationManager.cancel in the service implementation.

报警服务示例是此处。我想你知道使用通知管理器。

Alarm Service Sample is here. I suppose you know to use Notification Manager.

更多推荐

如何在Android上的特定时间后删除通知?

本文发布于:2023-11-27 08:16:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637242.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:通知   时间   如何在   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!