Ive ने कुछ उदाहरण दिए हैं जब उपयोगकर्ता अधिसूचना पर क्लिक करता है लेकिन मैं वास्तव में कुछ भी नहीं करना चाहता हूं। यदि उपयोगकर्ता अधिसूचना पर क्लिक करता है तो मैं अधिसूचना चाहता हूं कि अधिसूचना बस गायब हो और उपयोगकर्ता कहीं भी नहीं ले जाये।एक अधिसूचना कैसे लिखें जो क्लिक करते समय पूर्ण रूप से कुछ भी नहीं करता है?
नीचे दिए गए मेरे कोड में, जबकि FLAG_AUTO_CANCEL स्टेटस बार से अधिसूचना को साफ़ करता है, जब उपयोगकर्ता मेरी अधिसूचना पर क्लिक करता है तो उन्हें "MyActivity" पर ले जाया जाता है।
मैं एक अधिसूचना कैसे बना सकता हूं जो कुछ भी नहीं करता?
Notification notification = new Notification(R.drawable.success, res.getString(R.string.messages_sent), System.currentTimeMillis());
//Define the expanded message and intent
Context context = getApplicationContext();
CharSequence contentTitle = res.getString(R.string.messages_sent_ellipsis);
Intent notificationIntent = new Intent(this, MyActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, mStrSuccessMessage, contentIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
//Pass the notification to the notification manager
mNotificationManager.notify(1, notification);
संभावित डुप्लिकेट [जब उपयोगकर्ता उस पर क्लिक करता है तो मैं अधिसूचना कैसे रद्द कर सकता हूं?] (Http://stackoverflow.com/questions/7682009/how-can-i-cancel-a-notification-when-the- उपयोगकर्ता के क्लिक के-ऑन-यह) –