user6450105
user6450105

Reputation:

How FCM knows who will receive upstream message?

I am developing an app where I am using Firebase Cloud Messaging. And I want to send notification message from my device to other device that are in topic group "teamAndroid". I read on Firebase official site that with this code we send that upstream messages:

FirebaseMessaging fm = FirebaseMessaging.getInstance();

fm.send(new RemoteMessage.Builder(SENDER_ID + "@gcm.googleapis.com")
.setMessageId(Integer.toString(msgId.incrementAndGet()))
.addData("my_message", "Hello World")
.addData("my_action","SAY_HELLO")
.build());

But where in this code we put information about which user we want to send message? How FCM knows where to send that message which is sent by me?

Upvotes: 1

Views: 1340

Answers (1)

Rohan
Rohan

Reputation: 1190

FCM does not offer a direct device-to-device messaging facility. "Upstream message" here means that the message is being sent from your phone to an app server, which you have to implement.

See the docs for more details.

To send a message from one device to another, you send it to your app server from device 1, which in turn sends a downstream message to device 2.

Upvotes: 3

Related Questions