How can I schedule the flutter notification with Firebase to run in the background even if the mobile phone is turned off.

Solution 1: Nedim Karavdic

Make sure to check out Firebase cloud messaging if you want to make notifications for marketing purposes. If you want to store notifications locally check this video out:

Solution 2: marvinsxtr

There are several options for this task depending on your specific scheduling requirements.

  1. Schedule a local notification, which is for example triggered by the users themselves (e.g. some reminder or timer). In this case, the Flutter local notifications plugin does the trick.

These options make use of the Firebase cloud messaging service, for setup follow this guide:

  1. For scheduling notifications once in a while (e.g. for marketing purposes), the cloud messaging tab in Firebase offers a user interface for scheduling notifications.
  2. Schedule notifications repeating at a fixed interval with cloud functions. This can be done by utilizing the cronjob-like scheduling functionality.
  3. Schedule notifications starting from a certain point in time (with a delay) using cloud functions combined with cloud tasks like described here.
  4. A more complicated way of implementing tasks is described here, but I would not recommend it if you want an elegant solution.

In the end, scheduling notifications comes down to implementing a scheduling mechanism for cloud functions.

Solution 3: Rashid Abdulla

TLDR: You can use the firebase_notification_scheduler package to schedule notifications in Flutter.

Creating API Keys

This plugin makes use of a Rapid API service. You need to Signup for the Firebase Notification Scheduler Rapid API and get API Key from here. Then create your authentication key from here to work with package

Initialising Package

final FirebaseNotificationScheduler firebaseNotificationScheduler =  
        authenticationKey: <YOUR-RAPID-API-KEY> ,
        rapidApiKey:  <YOUR-AUTHENTICATION-KEY>

Scheduling a notification

//Schedules a notification to the topic 'any' for next minute
    final String _payload = {
      "to": "/topics/any",
      "notification": {
        "title": "Title of Your Notification",
        "body": "Body of Your Notification"
      "data": {"key_1": "Value for key_1", "key_2": "Value for key_2"}
    final DateTime _now =;
    final DateTime _dateTimeInUtc = _now.add(const Duration(minutes: 1));

    await firebaseNotificationScheduler.scheduleNotification(
        payload: _payload, dateTimeInUtc: _dateTimeInUtc);