I am currently trying to make a personal location application between 2 devices on Android.
The concept is simple: I install my application on my phone as well as on that of my wife and each can geolocate the other. (This application is strictly personal)
To achieve this, I thought of using sending notifications by FCM. Telephone A sends a request to telephone B which listens via a service for the reception of a message. When phone B receives the request, it returns the GPS coordinates via FCM so that phone A displays them on a MAP. (I also have the possibility to store the coordinates in a database instead of sending back an FCM message)
But FCM's documentation says: "When your app is in the background, notification messages are displayed in the system tray, and onMessageReceived is not called. For notification messages with a data payload, the notification message is displayed in the system tray, and the data that was included with the notification message can be retrieved from the intent launched when the user taps on the notification."
Of course, this reduces the scope since it forces the user of the phone receiving the notification to click on it to activate the actions of the service. Can FCM still meet my needs through another channel? Are there other options to send a "request" to another phone?
(I know that this kind of application exists on the PlayStore, but I want to try to make mine :-))
The key word in that section from the documentation you quote is notification messages. Firebase Cloud Messaging supports two types of messages:
It sounds like you'll want to use data messages for this use-case