【发布时间】:2013-12-20 08:23:27
【问题描述】:
我正在开发一个具有多个警报管理器的 android 应用程序。它们是使用广播接收器触发的,还有一些只是在给定时间段后触发。
我想知道的是,我如何通过识别这多个警报来停止/取消警报管理器。
【问题讨论】:
标签: android broadcastreceiver alarmmanager
我正在开发一个具有多个警报管理器的 android 应用程序。它们是使用广播接收器触发的,还有一些只是在给定时间段后触发。
我想知道的是,我如何通过识别这多个警报来停止/取消警报管理器。
【问题讨论】:
标签: android broadcastreceiver alarmmanager
AlarmManager 由其待定意图唯一标识。浏览我的演示示例
Intent imageFetchingService = new Intent(mContext, ImageFetchingService.class);
PendingIntent imageFetchingPendingIntente = PendingIntent.getService(
mContext, 0, imageFetchingService,
PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) mContext
.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(imageFetchingPendingIntente);
alarmManager.set(AlarmManager.RTC_WAKEUP, 120000,
imageFetchingPendingIntente);
【讨论】: