单击它们时访问通知

时间:2013-06-20 08:34:07

标签: android android-notifications

我有一个Android应用程序可以收到通知。当用户点击其中任何一个时,他总是会被重定向到同一个Activity。在此活动中,我检查了一个参数(使用此参数,我必须对服务器进行查询),这是我收到通知时保存的。

问题在于Activity是相同的,因此,我使用相同的密钥保存参数,并且我只有一个又一次被覆盖的密钥,保留了最后一个通知的最后一个值。所以,我按下的任何通知,它将获得最后一次的价值。我可以用一些技巧保存同名的所有这些吗?我可以在用户点击它时访问该消息吗?

                    String room = intent.getExtras().getString(ConstantsGCM.GCM_ROOM);
                    notif = new Notification(icon, textStatus, time);
                    notIntent = new Intent(contexto,GameMainActivity.class);
                    notIntent.putExtra(ConstantsRooms.ROOM, room); --> parameter that I need in the GameMainActivity.               
                    contIntent = PendingIntent.getActivity(contexto, 0, notIntent, 0);               
                    notif.setLatestEventInfo(contexto, tittle, description, contIntent);

                    //AutoCancel: cuando se pulsa la notificaiÛn Èsta desaparece
                    notif.flags |= Notification.FLAG_AUTO_CANCEL;

                    notManager.notify((int)(Math.random()*10000), notif);

另一个问题是,如果我不想更新通知,是否必须在notify方法中提供ID?

0 个答案:

没有答案