आपका सूचना JSON
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"icon" : "myicon"
},
firebase के डिफ़ॉल्ट कार्यक्षमता का उपयोग सूचना पट्टी में संदेश दिखाने के लिए जब आवेदन बंद कर दिया है शामिल होना चाहिए। अधिक जानकारी के
वैकल्पिक रूप से
onMessageReceived
सभी मामलों में सक्रिय होना चाहिए के लिए this की जाँच करें, ताकि आप
private void sendNotification(String messageBody) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("FCM Message")
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
का उपयोग कर आप अपने पेलोड पोस्ट कर सकते हैं अधिसूचना उत्पन्न कर सकते हैं? –
नया एफसीएम का उपयोग करने का क्या मतलब है? क्या आप अपने ऐप सर्वर से संदेश भेज रहे हैं, या आप संदेश भेजने के लिए फायरबेस संगीतकार का उपयोग कर रहे हैं? –
हाँ मैं अपने सर्वर – redochka