@Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); PLog.d(ParseFCM.TAG, "onMessageReceived"); String pushId = remoteMessage.getData().get("push_id"); String timestamp = remoteMessage.getData().get("time"); String dataString = remoteMessage.getData().get("data"); String channel = remoteMessage.getData().get("channel"); JSONObject data = null; if (dataString != null) { try { data = new JSONObject(dataString); } catch (JSONException e) { PLog.e(ParseFCM.TAG, "Ignoring push because of JSON exception while processing: " + dataString, e); return; } } PushRouter.getInstance().handlePush(pushId, timestamp, channel, data); } }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { if (remoteMessage.getNotification() != null){ //log it up } notifyUser(remoteMessage.getFrom(), remoteMessage.getNotification().getBody()); }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); String message = remoteMessage.getData().get("message"); Log.d(TAG, "From: " + remoteMessage.getFrom()); Log.d(TAG, "Message: " + message); //Check first if notification related to Instabug or not if (Instabug.isInstabugNotification(remoteMessage.getData())) { //Shown notification related to Instabug Instabug.showNotification(remoteMessage.getData()); } else { sendNotification(message); } }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); Log.d("AnyAudioFirebase", "message rec"); // if payloads available if (remoteMessage.getData().size() > 0) { Log.d("AnyAudioFirebase", "message received"); AnyAudioPushHandler.getInstance(this) .setNotificationPayload(remoteMessage.getNotification()) .handlePush(remoteMessage.getData()); } }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { Log.e(TAG, "From: " + remoteMessage.getFrom()); if (remoteMessage == null) return; // Check if message contains a notification payload. if (remoteMessage.getNotification() != null) { Log.e(TAG, "Notification Body: " + remoteMessage.getNotification().getBody()); handleNotification(remoteMessage.getNotification().getBody()); } // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) { Log.e(TAG, "Data Payload: " + remoteMessage.getData().toString()); try { JSONObject json = new JSONObject(remoteMessage.getData().toString()); handleDataMessage(json); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } } }
@Override public void onMessageReceived(RemoteMessage message) { String messageId = message.getMessageId(); if (TextUtils.isEmpty(messageId)) { final Notification notification = createNotification(message.getData()); if (notification == null) {
@Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); Log.d("Msg", "Message received ["+remoteMessage+"]"); // Create Notification Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 1410, intent, PendingIntent.FLAG_ONE_SHOT); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_stat_name) .setContentTitle("Message") .setContentText(remoteMessage.getNotification().getBody()) .setAutoCancel(true) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(1410, notificationBuilder.build()); } }
/** * Called when message is received. * * @param remoteMessage Object representing the message received from Firebase Cloud Messaging. */ @Override public void onMessageReceived(RemoteMessage remoteMessage) { Log.d(TAG, "Received onMessageReceived()"); Log.d(TAG, "Bundle data: " + remoteMessage.getData()); Log.d(TAG, "From: " + remoteMessage.getFrom()); // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) { Map<String, String> data = remoteMessage.getData(); final int notificationId = (int) System.currentTimeMillis(); Voice.handleMessage(this, data, new MessageListener() { @Override public void onCallInvite(CallInvite callInvite) { VoiceFirebaseMessagingService.this.notify(callInvite, notificationId); VoiceFirebaseMessagingService.this.sendCallInviteToActivity(callInvite, notificationId); } @Override public void onError(MessageException messageException) { Log.e(TAG, messageException.getLocalizedMessage()); } }); } }
@Override public void onMessageReceived(RemoteMessage message) { RemoteMessage.Notification notification = message.getNotification(); if (notification != null) { String title = notification.getTitle(); String body = notification.getBody(); // Post your own notification using NotificationCompat.Builder // or send the information to your UI } // Listing 11-31: Receiving data using the Firebase Messaging Service Map<String,String> data = message.getData(); if (data != null) { String value = data.get("your_key"); // Post your own Notification using NotificationCompat.Builder // or send the information to your UI } } }
.setSmallIcon(R.drawable.notificacion) .setContentTitle("Notificacion") .setContentText(remoteMessage.getNotification().getBody()) .setAutoCancel(true) .setSound(sonido)
Log.d(TAG, "From: " + remoteMessage.getFrom()); if (remoteMessage.getData().size() > 0) { Log.d(TAG, "Message data payload: " + remoteMessage.getData()); String title = remoteMessage.getData().get("title"); String message = remoteMessage.getData().get("text"); String username = remoteMessage.getData().get("username"); String uid = remoteMessage.getData().get("uid"); String fcmToken = remoteMessage.getData().get("fcm_token");
@Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); if (remoteMessage != null) { // check if message contains a data payload if (remoteMessage.getData() != null && remoteMessage.getData().size() > 0) { Notification notification = createNotificationObject(remoteMessage); storeNotification(notification); raiseSystemNotification(notification); } // Check if message contains a notification payload if (remoteMessage.getNotification() != null) { // TODO: Decide if any action is needed here } } }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { Log.i(TAG, "Message data:" + remoteMessage.getData()); if (remoteMessage.getData().size() > 0) { if (MobiComPushReceiver.isMobiComPushNotification(remoteMessage.getData())) { Log.i(TAG, "Applozic notification processing..."); MobiComPushReceiver.processMessageAsync(this, remoteMessage.getData()); return; } } }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { //Displaying data in log //It is optional Log.d(TAG, "From: " + remoteMessage.getFrom()); Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody()); //Calling method to generate notification sendNotification(remoteMessage.getNotification().getBody()); }
super.onMessageReceived(remoteMessage); String notification_title = remoteMessage.getNotification().getTitle(); String notification_message = remoteMessage.getNotification().getBody(); String click_action = remoteMessage.getNotification().getClickAction(); String from_user_id = remoteMessage.getData().get("from_user_id");
@Override public void onMessageReceived(RemoteMessage remoteMessage) { //super.onMessageReceived(remoteMessage); Log.d(TAG, "From: " + remoteMessage.getFrom()); Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody()); enviarNotificacion(remoteMessage); }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { // TODO(developer): Handle FCM messages here. // If the application is in the foreground handle both data and notification messages here. // Also if you intend on generating your own notifications as a result of a received FCM // message, here is where that should be initiated. See sendNotification method below. log.info("From: " + remoteMessage.getFrom()); String notificationBase64 = remoteMessage.getData().get("notification"); if (notificationBase64 == null) { log.info("Notification is null, ignoring."); return; } Notification notification; try { notification = Notification.ADAPTER.decode(Base64.decode(notificationBase64, 0)); } catch (IOException e) { log.warning("Error decoding notification, dropping.", e); return; } if (notification.debug_message != null) { App.i.getTaskRunner().runTask(() -> Toast.makeText(App.i, notification.debug_message, Toast.LENGTH_LONG).show(), Threads.UI); } // TODO: handle other kinds of toasts. }
@Override public void onMessageReceived(RemoteMessage remoteMessage) { // If the application is in the foreground handle both data and notification messages here. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { createNotificationChannel(getApplicationContext()); } // Ignore notifications if alerts are disabled in settings. if (!areAlertsEnabled()) { return; } // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) { Map<String, String> data = remoteMessage.getData(); switch (data.get(TYPE_KEY)) { case CGA_TYPE: onCgaMessageReceived(data); break; case SCORES_UPDATE_TYPE: onScoresUpdateReceived(data); break; } } // Check if message contains a notification payload. if (remoteMessage.getNotification() != null) { // Handle notification. } }