I am implementing a service that will push notifications/messages to client devices(android/ios) based on the real time location. If the client is within a predefined radius, the service shall send them a custom message that is tailored towards that location. I am using firebase. The notifications should be sent when the application is active or in the background.
Firebase Cloud Messaging (FCM), formerly known as Google Cloud Messaging (GCM), is a cross-platform cloud solution for messages and notifications for Android, iOS, and web applications, which as of June 2022 can be used at no cost.
The FCM backend receives the message request, generates a message ID and other metadata, and sends it to the platform specific transport layer. When the device is online, the message is sent via the platform-specific transport layer to the device. On the device, the client app receives the message or notification.
FCM does not guarantee the order of delivery. Some typical use cases of non-collapsible messages are chat messages or critical messages. For example, in an IM app, you would want to deliver every message, because every message has different content.
There is several aproaches :
use fcm topic, but you have to combine with geofencing, whenever user enter or leave certain radius from specific location, it will subscribe or unsubscribe to certain topic
use library called geo-fire, with that library you can query all the user that has certain radius from certain specific location. You can combine with cloud function to send center location as parameter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With