Aaditya Sindhu
Aaditya Sindhu

Reputation: 11

Will a FCM message, open a firebase database connection?

I want to know, if my app is in background and it recieves a fcm message, will this automatically open a firebase connection to sync my active references? I would like to run a service on recieving a fcm message which then attaches a onChildAdded and singleValueEvent listener to a database ref (keep_synced true) and performs the actions in background, and then the service stops itself when the value event occurs. Wanted to know if this approach guarantees that I will receive all the children added to that location by that time ?

Thanks a lot

Upvotes: 0

Views: 268

Answers (2)

Frank van Puffelen
Frank van Puffelen

Reputation: 599041

No, there will be no automatic connection to the Firebase Database when the FCM message is received.

You'll have to process the FCM message for that and then reconnect your database listeners or go online.

Upvotes: 0

nullvoid
nullvoid

Reputation: 131

NO. You have to update the value by yourself. FCM is a replacement of GCM, it is used just to send notification. You can handle the FCM and then call the listener which update all the child at that node.

Upvotes: 1

Related Questions