Bijoy
Bijoy

Reputation: 146

How Android Oreo Knows that an FCM Message has arrived?

I know that FCM messages are sent to devices corresponding to FirebaseInstanceId.getInstance().getToken() and on onMessageReceived() the FCM messages are handled according to the need of the User. But if the app is not running and with all the background limitations in Oreo how the OS knows that a message has arrived?

Upvotes: 0

Views: 107

Answers (1)

Tim
Tim

Reputation: 43364

how the OS knows that a message has arrived?

There is a socket connection between the phone and google's FCM server. This connection is shared between all apps on the phone that use FCM.
See here

When you ask FCM to deliver a message to your phone ABC and to the app with id XYZ, google's server will send some data to phone ABC. The FCM component on the phone then finds the app with id XYZ (it has to look up the correct app first because this connection might also receive data for other apps) and deliver the message to id.

This is managed by google so naturally the process doesn't suffer from background restrictions, assuming you set the right priority for your FCM message.

Upvotes: 1

Related Questions