@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) { //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()); }
/** * 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 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()); } } }
Log.d(TAG, "From: " + remoteMessage.getFrom());
/** * Called when message is received. * * @param remoteMessage Object representing the message received from Firebase Cloud Messaging. */ // [START receive_message] @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.d(TAG, "From: " + remoteMessage.getFrom()); Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody()); sendNotification(remoteMessage.getNotification().getBody()); } // [END receive_message]
@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) { if (remoteMessage.getNotification() != null){ //log it up } notifyUser(remoteMessage.getFrom(), remoteMessage.getNotification().getBody()); }
Log.d(TAG, "From: " + remoteMessage.getFrom());
@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. }
if (rmessage == null) return; if (GcmActivity.cease_all_activity) return; String from = rmessage.getFrom();
if (rmessage == null) return; if (GcmActivity.cease_all_activity) return; String from = rmessage.getFrom();