Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use FCM with another database

I am developping a mobile application that must implement push notifications. Documents are stored on a SQL database, and people should be able to edit these docs after downloading them offline, then the modifications should be saved in the SQL Database once the phone is online again. People should be able to receive notifications when the app is closed.

I heard that I need push notifications, and for android there is Firebase Cloud Messaging (FCM). But is it possible to use FCM with my SQL database ?

All tutorials in the docs only speak about connecting the app with Firebase

like image 508
Amanite Laurine Avatar asked Oct 05 '17 12:10

Amanite Laurine


1 Answers

For your project you need a server with your API, SQL Database... and a push notification server that ask FCM services to notify your registered devices.

FCM works like that : You add the FCM plugin in your Android/iOS app, then when you launch the application it will ask FCM for a unique token associated for your device and this app. You will store that unique token in your push notification server, I advise you to associate it with a user identifier or one thing that you will use to identify the device to notify.

When your first server (with the APIs and the Database) did some action and you want to notify a device :

The server will ask your push notification server to notify a list of devices that you will probably determine with the user identifier like I said earlier, then the push notification server will find the associated tokens and send all of the pre stored tokens to FCM with the notification content you want to send, you can also send parameters that will be used to do special actions in your mobile app.

Finally FCM will notify your devices :)

Hope it helps.

like image 73
fandro Avatar answered Sep 22 '22 12:09

fandro