मैं इस कोड के माध्यम से एक BroadcastReceiver अंदर एक अधिसूचना बनाने हूँ:अधिसूचना गुजरता वर्ष आशय अतिरिक्त
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
int icon = R.drawable.ic_stat_notification;
CharSequence tickerText = "New Notification";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_VIBRATE;
long[] vibrate = {0,100,200,200,200,200};
notification.vibrate = vibrate;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
CharSequence contentTitle = "Title";
CharSequence contentText = "Text";
Intent notificationIntent = new Intent(context, NotificationActivity.class);
notificationIntent.putExtra(Global.INTENT_EXTRA_FOO_ID, foo_id);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
int mynotification_id = 1;
mNotificationManager.notify(mynotification_id, notification);
जब मैं अधिसूचना पर क्लिक करें, यह NotificationActivity खोलता है और गतिविधि के अंदर मैं आशय से foo_id प्राप्त कर सकते हैं -बंडल (उदाहरण 1)
हालांकि अगर कोई अन्य अधिसूचना ट्रिगर हो जाती है और मैं इसे फिर से क्लिक करता हूं, तो गतिविधि को अभी भी "पुराने" मान (1) को मंशा-बंडल से प्राप्त होता है। मैंने स्पष्ट() के साथ बंडल को साफ़ करने का प्रयास किया है, लेकिन मुझे एक ही प्रभाव प्राप्त हो रहा है। मुझे लगता है कि मेरे कोड के साथ sth गलत है ..
कृपया आप मुझे बताओ कि तुम आशय – user49557
लंबित एहसास है कि यह वर्ष अतिरिक्त भेज रही थी, मेरे लिए आसान triaging बनाया से डेटा प्राप्त कर सकते हैं। –