Scheduled Notifications with Firebase and background running

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.

  • iOS Swift - Get the Current Local Time and Date Timestamp
  • Firebase Connection manager should return only one result
  • Retrieving specific Firebase data that is stored in a childByAutoId() Reference (Swift)
  • Obtain NSURL from UIImagePickerController
  • Firebase First Open event is not correct
  • Firebase: Can I use Facebook's new Account Kit to authenticate app users?
  • 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


    What can I do? Should I take a look at services like Parse? Any help is greatly appreciated.

    2 Solutions Collect From Internet About “Scheduled Notifications with Firebase and background running”

    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.