【发布时间】:2019-03-08 13:14:37
【问题描述】:
我使用 Call 操作创建本地通知。通知使用以下代码触发,每个通知都有不同的通知 ID:
Intent myIntent = new Intent(mContext, NotificationService.class);
myIntent.putExtra("phoneNumber", phone);
myIntent.putExtra("notificationId", notificationId);
AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(ALARM_SERVICE);
PendingIntent pendingIntent = PendingIntent.getService(mContext, notificationId, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.set(AlarmManager.RTC_WAKEUP, startTime, pendingIntent);
在NotificationService.class 我创建并显示通知
notificationManager.notify(notificationId, mBuilder.build());
我以几秒钟的间隔触发两个通知,并且两者都在状态栏中可见。 假设第一个必须对 1111 进行呼叫操作,而第二个必须对 2222 进行呼叫操作。 如果我按下第一个呼叫操作,它将呼叫 2222。有什么问题?
【问题讨论】:
-
发布来自
Service的代码,获取“附加”并拨打电话。
标签: android android-notifications android-pendingintent android-alarms