मैं अपने ऐप पर पुश अधिसूचना का उपयोग कर रहा हूं। जब कोई पुश अधिसूचना आती है, तो मैं एक अधिसूचना प्रदर्शित करता था, अगर मैं एक और अधिसूचना भेजता हूं (पिछली अधिसूचना को साफ़ किए बिना) यह नई अधिसूचना को प्रतिस्थापित करता है।धक्का अधिसूचना प्राप्त करते समय एक नई अधिसूचना जोड़ें (पुराने को प्रतिस्थापित नहीं करें)
यह मैं
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int icon = R.drawable.ic_launcher;
CharSequence tickerText = "New notification Pending";
long time = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, time);
notification.flags = Notification.DEFAULT_LIGHTS
| Notification.FLAG_AUTO_CANCEL;
// Context context = getApplicationContext();
CharSequence contentTitle = "Notifications";
CharSequence contentText = newMessage;
Intent notificationIntent = new Intent(this, LoginActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText,
contentIntent);
mNotificationManager.notify(1, notification);
का उपयोग, लेकिन मैं अधिसूचना को बदलने के लिए नहीं करना चाहती कोड है, मैं एक नई अधिसूचना के रूप में यह जोड़ना चाहते थे।
इसका एक उत्कृष्ट विचार। क्योंकि समय आईडी कभी दोहराया नहीं जाता है। मैं PHP में भी इसका उपयोग करता हूं। धन्यवाद। लेकिन सूचित करने के लिए अपना कोड बदलें (आईडी, अधिसूचना); यह दूसरों के लिए उपयोगी हो सकता है –
धन्यवाद इंद्र का उल्लेख करने के लिए, अब मैंने आईडी के साथ 1 को बदल दिया है। –
thanqu sir ..for इसे पोस्ट किया गया –