【发布时间】:2017-01-18 17:18:30
【问题描述】:
我正在开发一个具有类似闹钟功能的 android 项目。
我为每个警报实例安排了一个 intentService(例如,在晚上 9 点触发),这个 intentService 构建通知并显示它。该通知包括一个 fullScreenIntent,它按预期工作并启动活动。我使用以下代码来执行此操作:
alarmActivityIntent = new Intent(this, AlarmActivity.class);
PendingIntent alarmActivityPendingIntent = PendingIntent.getActivity(this, alertSchedule.getIntentId(), alarmActivityIntent, PendingIntent.FLAG_CANCEL_CURRENT);
mBuilder.setFullScreenIntent(alarmActivityPendingIntent, true);
Notification mNotification = mBuilder.build();
mNotificationManager.notify(alertSchedule.getIntentId(), mNotification);
当只有一个警报设置为在特定时间触发时,这会按预期工作,但是如果两个警报设置为在特定时间触发,则行为会发生变化。
我希望第一个 fullScreenIntent 开始其活动,然后当该活动完成时,显示下一个。我相信我想建立一个任务堆栈,并将这些警报意图推送到它上面。然而,这对我来说是全新的。
是否可以对这些通知进行分组?
【问题讨论】:
标签: android android-intent notifications android-pendingintent