I want my Firebase to send scheduled push notifications to all the users of my application and if the app is in the background; run some code and send some stuff to the server.
I'm a bit lost because it's impossible to do so with the notification console from Firebase.
Then, I was interested in Firebase Cloud Messaging, but in the documentation, it says that the connection to FCM should be ended :
When your app goes into the background, disconnect from FCM
-Source
What can I do? Should I take a look at services like Parse? Any help is greatly appreciated.
Notification messages don't execute your application code when your app is in the background. All messages sent from the Firebase console are Notification messages. So you can't currently use the Firebase console for what you are describing.
However you can send Data messages from your app server which can trigger background execution of code. You will have to manage the scheduling yourself on your app server.
I solved my problem building a server where the user register his token (unique identifier) to a database. There is also a PHP script for sending push notifications. You can find all of this here.
I edited the PHP script to send a payload which contains :
["content-available"] = "1"
This payload will trigger what you want to do when your app is in the background.
I used a crontab on my server to regularly send push notifications.
The notification console from Firebase can send push notification but not silent push notification that we want in my case.