我想创建几个启动活动(或刷新活动)以显示产品描述的通知。
Notification notification = new Notification(R.drawable.applicationicon,
Resources.getString("NewSaleNotification", context),
System.currentTimeMillis());
// Hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(context, MainApplication.class);
intent.putExtra("saleid", saleid);
// to be sure the activity won't be restarted
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, SaleTitle, SaleMessage, pendingIntent);
notificationManager.notify(saleid, notification);
当我创建 PendingIntent 时,我有 4 个选择:FLAG_CANCEL_CURRENT、FLAG_NO_CREATE、FLAG_ONE_SHOT 和 FLAG_UPDATE_CURRENT。
最后一个(http://developer.android.com/reference/android/app/PendingIntent.html#FLAG_UPDATE_CURRENT)的定义是我想要做的,但它不能正常工作。如果我创建 2 个通知,它们都具有相同的“saleid”额外信息,这是最新的。如何使用不同的“saleid”额外发出多个通知?