/** * Sends the given {@link Message} via Firebase Cloud Messaging. * * @param message A non-null {@link Message} to be sent. * @return A message ID string. */ public String send(@NonNull Message message) throws FirebaseMessagingException { return send(message, false); }
private static void fmSend(Bundle data) { final FirebaseMessaging fm = FirebaseMessaging.getInstance(); if (senderid != null) { fm.send(new RemoteMessage.Builder(senderid + "@gcm.googleapis.com") .setMessageId(Integer.toString(msgId.incrementAndGet())) .setData(JoH.bundleToMap(data)) .build()); } else { Log.wtf(TAG, "senderid is null"); } }
private static void fmSend(Bundle data) { final FirebaseMessaging fm = FirebaseMessaging.getInstance(); if (senderid != null) { fm.send(new RemoteMessage.Builder(senderid + "@gcm.googleapis.com") .setMessageId(Integer.toString(msgId.incrementAndGet())) .setData(JoH.bundleToMap(data)) .build()); } else { Log.wtf(TAG, "senderid is null"); } }
private void sendNotification(DeviceInfo device, String notificationBase64) { Message msg = Message.builder() .putData("notification", notificationBase64) .setToken(device.fcm_device_info.token) .build(); try { String resp = FirebaseMessaging.getInstance().send(msg); log.info("Firebase message sent: %s", resp); } catch(FirebaseMessagingException e) { log.error("Error sending firebase notification: %s", e.getErrorCode(), e); } } }