guness guness - 2 months ago 82x
Android Question

How to send upstream messages with FCM from android client?

We were using

GoogleCloudMessaging.getInstance(context).send(context.getString(R.string.gcm_defaultSenderId) + "", mId, mBundle);
to send upstream messages, but since I was trying to migrate new
concept, I need to change that too, but could not find any documentation yet.

My best guess is to use :

RemoteMessage message = new RemoteMessage.Builder(<?>).setMessageId(mId).setData ...

but then what is it the Builder takes as a parameter? Yet again, could not find api...

So simply as title states, how to send upstream messages using new


Well, my answer comes fast. Keeping question and answer for future reference. I have found the answer on

thanks to google's smart exclusion to search results In order to show you the most relevant results, we have omitted some entries very similar to the 2 already displayed. If you like, you can repeat the search with the omitted results included.

new API would be like:

FirebaseMessaging fm = FirebaseMessaging.getInstance();
fm.send(new RemoteMessage.Builder(SENDER_ID + "")
  .addData("my_message", "Hello World")