Java 意图中的数据不匹配
我有一个问题,就是将数据放在意图和读取数据之间的数据不匹配。 在我的服务中,我创建通知并向意图添加参数。 当我看到通知时,参数正常。但是,当我打开通知时,参数会以有线方式运行。我在我的系统中得到了真实的参数,但在发送后没有。 这个问题是因为我正在我的服务中创建通知吗Java 意图中的数据不匹配,java,android,Java,Android,我有一个问题,就是将数据放在意图和读取数据之间的数据不匹配。 在我的服务中,我创建通知并向意图添加参数。 当我看到通知时,参数正常。但是,当我打开通知时,参数会以有线方式运行。我在我的系统中得到了真实的参数,但在发送后没有。 这个问题是因为我正在我的服务中创建通知吗 public void createNotification(ChatMessage message) { Notification notification = new Notification(R.drawable.
public void createNotification(ChatMessage message)
{
Notification notification = new Notification(R.drawable.ic_action_sm,
"Message From" +
" " + message.getSenderName(),
System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(this, ChatActivity.class);
intent.putExtra("userProfile", message.getReciverChatProfile());
intent.putExtra("friendProfile", message.getSenderChatProfile());
PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
notification.setLatestEventInfo(this,
message.getSenderName(),
message.getMessage(),
activity);
notification.number += 1;
notification.iconLevel = 3;
notificationManager.notify(0, notification);
}
添加标志\u UPDATE\u CURRENT解决了问题
PendingIntent activity = PendingIntent.getActivity(this, 0,intent,PendingIntent.FLAG_UPDATE_CURRENT);