我希望创建多个通知,以启动一个活动(或刷新它),以显示产品描述。
当我创建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”额外信息的通知?
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”额外信息的通知?