只有一个通知可以从几个中点击
Only one Notifcation is clicable from a few
问题是:在我的代码中,我发送了 4 个通知。但是只有一个顶部通知打开我的 Activity 另外 3 个在点击时什么都不做。
这是我发送通知的代码。我在我的程序中做了 4 次。
通知 ID 始终不同。
Intent notificationIntent = new Intent(context, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context,
0, notificationIntent,
PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.element)
.setContentTitle(getResources().getString(R.string.app_name))
.setContentText(messages.get(messageCount).toString());
Notification notification = builder.build();
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
notificationManager.notify(messageCount, notification);
请帮助。谢谢!
问题是 android "eat" 与未决意图相同的意图。
您需要使用不同的额外 and/or 请求代码
使它们不同
问题是:在我的代码中,我发送了 4 个通知。但是只有一个顶部通知打开我的 Activity 另外 3 个在点击时什么都不做。
这是我发送通知的代码。我在我的程序中做了 4 次。 通知 ID 始终不同。
Intent notificationIntent = new Intent(context, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context,
0, notificationIntent,
PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.element)
.setContentTitle(getResources().getString(R.string.app_name))
.setContentText(messages.get(messageCount).toString());
Notification notification = builder.build();
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
notificationManager.notify(messageCount, notification);
请帮助。谢谢!
问题是 android "eat" 与未决意图相同的意图。 您需要使用不同的额外 and/or 请求代码
使它们不同