ANDROID 删除提醒
我有一个已知 ID 的提醒,但找不到删除它的解决方案...我已经以这种方式添加了通知: http://developer.android.com/guide/topics/ui/notifiers/notifications.html 并使用 AlarmManager...
我相信解决方案应该类似于:
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intentAlarm = new Intent(ShowEmission.this, CustomAlarm.class);
intentAlarm.putExtra...
...
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, .., intentAlarm, PendingIntent.FLAG_ONE_SHOT);
am.cancel(pendingIntent);
但是对此有一些想法......因为命令设置是:
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, flags)
所以基本上我已经存储了 requestCode...比我相信我应该能够用这个 requestCode 删除警报...
请就这个问题向我提供建议...我真的不知道如何解决它...谢谢!
I have reminder with a known ID, but couldn't find a solution to delete it... I have added Notification this way: http://developer.android.com/guide/topics/ui/notifiers/notifications.html and with AlarmManager...
I believe that solution should be something like:
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intentAlarm = new Intent(ShowEmission.this, CustomAlarm.class);
intentAlarm.putExtra...
...
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, .., intentAlarm, PendingIntent.FLAG_ONE_SHOT);
am.cancel(pendingIntent);
But have some thoughts about it ... since the command to set is:
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, flags)
so basically I have requestCode stored... Than I believe I should be able to delete the alarm with this requestCode...
Please advise me on this problem... I really have no idea how to solve it... Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用警报管理器的
取消
功能。这里有更多帮助
Use Alarm Manager's
cancel
function.Here's more Help