← Back to Documentation Home

Firebase Setup

Configure Firebase Cloud Messaging for push notifications — order updates, promotions, and real-time alerts.

Firebase Setup

Configure Firebase Cloud Messaging for push notifications — order updates, promotions, and real-time alerts.

Table of Contents
  1. Overview
  2. Create a Firebase project
  3. Register the Android app
  4. Register the iOS app (Mac only)
  5. FlutterFire configure (recommended)
  6. Connect the backend (server-side notifications)
  7. Test notifications
Important — Buyer's Own Account Required

Firebase is a third-party service provided by Google. You must create and maintain your own Firebase account. This is not included in your CodeCanyon purchase.

Firebase offers a generous free tier (Spark plan) that covers most small-to-medium apps. If your usage exceeds the free tier limits, Google will charge you based on their published pricing.

The author of FoodFeast has no control over Firebase pricing and is not responsible for any costs incurred.
1 Firebase

Overview#

FoodFeast uses Firebase Cloud Messaging (FCM) to send push notifications for order status updates (placed, preparing, out for delivery, delivered), promotional messages, and real-time alerts.

The app integrates Firebase through the following packages in pubspec.yaml:

PackagePurpose
firebase_coreFirebase initialization
firebase_messagingReceive and handle push notifications
awesome_notificationsDisplay rich local notifications with custom styling

2 Firebase

Create a Firebase project#

1

Go to the Firebase Console

Open console.firebase.google.com and click Create a Firebase project.

Firebase console home screen
2

Name your project

Type a name (e.g. FoodFeast). This is just a label in the console — it doesn't need to match your app's package name.

Naming the Firebase project
3

Confirm the generated project ID

Firebase auto-generates a unique project ID from the name (e.g. foodfeast-e6669). You'll see this ID again in step 05 when running flutterfire configure.

Confirming the generated project ID
4

Gemini in Firebase (optional)

Firebase may ask if you want to enable Gemini AI assistance in the console. This is entirely optional and has no effect on your app.

Gemini in Firebase opt-in screen
5

Enable Google Analytics (recommended)

Analytics is free and pairs with Cloud Messaging for delivery reporting. Leave it enabled unless you have a specific reason not to.

Enabling Google Analytics for the project
Once created, you'll land on an empty project dashboard like this — no apps registered yet. Empty Firebase project dashboard before any app is registered

3 Firebase

Register the Android app#

1

Click the Android icon on the project overview page

Enter your Android Application ID. You can find it in:

android/app/build.gradle
defaultConfig {
    applicationId = "com.example.foodfeast"
    ...
}

Replace com.example.foodfeast with your own package name if you've changed it.

Register Android app screen with package name field
2

Download google-services.json

Firebase generates this file. Download it and place it in:

android/app/google-services.json

This file replaces any sample/placeholder file that may already exist in that location.

Confirming package name and downloading google-services.json
3

Verify Gradle plugins

The project already includes the required Gradle configuration. Verify these lines exist:

android/build.gradle
buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.4.0'
    }
}
android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
The Application ID in Firebase must exactly match the applicationId in build.gradle. A mismatch causes the app to crash on launch.
If you're also building the FoodFeast Vendor or Rider apps, you can register them in this same Firebase project — your dashboard will then show all registered apps together, like this: Firebase project overview with multiple apps registered

4 Firebase

Register the iOS app (Mac only)#

1

Add an iOS app in Firebase Console

Click the iOS icon and enter the same Bundle Identifier used in Xcode (found in ios/Runner.xcodeproj → Signing & Capabilities).

2

Download GoogleService-Info.plist

Open ios/Runner.xcworkspace in Xcode. Drag the downloaded file into the Runner group in the project navigator. Check "Copy items if needed".

3

Enable Push Notifications capability

In Xcode → Runner → Signing & Capabilities → click + Capability → add Push Notifications and Background Modes (check "Remote notifications").

iOS push notifications only work on a physical device. The iOS simulator does not support FCM.

5 Firebase

The easiest way to keep your Firebase config files in sync across Android and iOS at once:

1

Add the Google services Gradle plugin

Add the plugin as a dependency in your project-level Gradle file (android/build.gradle.kts or android/build.gradle):

Adding the Google services Gradle plugin
2

Open a terminal in your project

Empty terminal window ready for commands
3

Install the Firebase CLI and FlutterFire CLI

npm install -g firebase-tools
dart pub global activate flutterfire_cli
Terminal running npm install firebase-tools and activating flutterfire_cli
4

Log in to Firebase

firebase login
Terminal running firebase login after installing the CLIs
5

Confirm the CLI login prompt

You may be asked whether to enable Gemini-powered CLI features — this is optional.

Firebase login CLI prompt
6

Sign in with your Google account

A browser window opens — choose the same Google account you used to create the Firebase project.

Google sign-in page for Firebase CLI authorization
7

Run the configure command from your project root

flutterfire configure
Terminal open in the Flutter project root directory
8

Select your Firebase project

The CLI lists every Firebase project on your account — pick the one you created for FoodFeast.

Selecting the Firebase project from the flutterfire configure list
The project picker shows every Firebase project on your account, not just FoodFeast-related ones — double-check you select the right one if you manage more than one app.
This generates lib/firebase_options.dart and places the native config files automatically — you won't need to manually download or move google-services.json / GoogleService-Info.plist yourself.

6 Firebase

Connect the backend (server-side notifications)#

For the backend to send push notifications when order status changes, it needs a Firebase Service Account key.

1

Generate a private key

In Firebase Console → Project Settings → Service Accounts → Generate new private key. A JSON file downloads.

2

Upload to your Admin Panel

Log into your FoodFeast Admin Panel → Business Settings → Notification Settings. Upload the JSON file there.

3

Test it

Create a test order from the app and change its status from the admin panel. You should receive a push notification.


7 Firebase

Test notifications#

1

Send a test message from Firebase Console

Go to Firebase Console → Messaging → Create your first campaign → Firebase Notification messages. Enter a title and body, select your app, and click Send test message.

Troubleshooting#

ProblemSolution
No notification received on AndroidVerify google-services.json is in android/app/ and the Application ID matches.
No notification on iOSMust test on a physical device. Verify GoogleService-Info.plist is in the Runner target and Push Notifications capability is enabled.
[firebase_core/not-initialized]Run flutterfire configure or manually verify firebase_options.dart has your project's config.
Backend doesn't send notificationsUpload the Service Account JSON in Admin Panel → Notification Settings.
FoodFeast · Firebase Setup Guide v1.1 · © FoodFeast