【问题标题】:android programming - postpone alarm manager's pending intentandroid编程 - 推迟警报管理器的未决意图
【发布时间】:2014-08-18 23:48:35
【问题描述】:

我实际上正在编写一个提醒 android 应用程序。我可以使用警报管理器和待定意图创建提醒,但我不知道如何推迟它们。

这是我创建提醒的方法...

AlarmManager mgr = (AlarmManager) c.getSystemService(Context.ALARM_SERVICE);
Inent notificationIntent = new Intent(c, ReminderAlert.class);
notificationIntent.putExtra("REM_NAME",remName );
PendingIntent pi = PendingIntent.getBroadcast(c, a unique id for the reminder, notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);
            mgr.set(AlarmManager.RTC_WAKEUP,remTime, pi);

我能够获得待处理意图中使用的意图...

我如何将警报管理器和待处理的意图推迟到一个新的时间(很长)?

【问题讨论】:

    标签: android android-intent android-pendingintent android-alarms


    【解决方案1】:

    为新的时间设置一个全新的闹钟。

    【讨论】:

    • 我试过了,但未调用未决意图。我认为这是因为我在pendingintent.getbroadcast 中为该提醒使用了相同的ID
    • 你测试过这个理论吗?设置一个新的ID只是为了看看它是否有效?因为如果是这样,您可以使用新的 id,然后在您用于存储警报的任何数据结构中更新 id。
    • 好的,我会这样做的。感谢您的帮助,加布!
    • 这并没有提供问题的答案。要批评或要求作者澄清,请在其帖子下方发表评论。
    • @Cfreak 是的。解决问题的不同方法始终是可接受的答案。做评论时请多加注意。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多