Push Notifications Setup Guide โ
This guide will help you set up push notifications for your MartFury Flutter app. Follow these simple steps to enable notifications for both Android and iOS.
๐ฑ What You'll Need โ
Before starting, make sure you have:
- A Google account (for Firebase)
- Access to your app's source code
- For iOS: An Apple Developer account ($99/year)
๐ฅ Step 1: Create a Firebase Project โ
- Go to Firebase Console
- Click "Create a project" or "Add project"
- Enter your project name (e.g., "MartFury App")
- Follow the setup wizard (you can disable Google Analytics if not needed)
- Click "Create project" and wait for it to complete
๐ค Step 2: Get Android Configuration File โ
Follow these steps to get your google-services.json file:
In Firebase Console:
- Click the Android icon or "Add app" โ "Android"
- Enter your Android package name (e.g.,
com.yourcompany.martfury) - Register the app
Download the configuration file:
- Click "Download google-services.json"
- Save this file to your computer
Add the file to your app:
- Open your app's folder
- Navigate to
android/app/ - Copy the
google-services.jsonfile here
For detailed instructions with screenshots, visit: Firebase Android Setup Guide
๐ Step 3: Get iOS Configuration File โ
Follow these steps to get your GoogleService-Info.plist file:
In Firebase Console:
- Click "Add app" โ "iOS"
- Enter your iOS bundle ID (e.g.,
com.yourcompany.martfury) - Register the app
Download the configuration file:
- Click "Download GoogleService-Info.plist"
- Save this file to your computer
Add the file to your app:
- Open your app's folder
- Navigate to
ios/Runner/ - Copy the
GoogleService-Info.plistfile here
Enable Push Notifications in Xcode:
- Open
ios/Runner.xcworkspacein Xcode - Select your project in the left sidebar
- Click on the "Signing & Capabilities" tab
- Click "+ Capability"
- Add "Push Notifications"
- Open
For detailed instructions with screenshots, visit: Firebase iOS Setup Guide
โ Step 4: Configure iOS Push Notifications (iOS Only) โ
For iOS to receive push notifications, you need to set up APNs certificates:
In Firebase Console:
- Go to Project Settings (gear icon)
- Click "Cloud Messaging" tab
- Scroll to "Apple app configuration"
Upload APNs Authentication Key (Recommended):
- Go to Apple Developer Portal
- Navigate to Keys and create a new key
- Enable Apple Push Notifications service (APNs)
- Download the
.p8key file - In Firebase Console, click "Upload" under APNs Authentication Key
- Upload your
.p8file and enter your Key ID and Team ID
Or Upload APNs Certificate (Alternative):
- Click "Upload" under APNs certificates
- You'll need to create this certificate in your Apple Developer account
- Follow Firebase's guide for creating APNs certificates
๐ง Step 5: Configure Botble Backend โ
Your Botble website needs to be configured to send push notifications via FCM v1 API.
5.1 Generate Service Account Key โ
- In Firebase Console, go to Project Settings (gear icon)
- Click "Service accounts" tab
- Click "Generate new private key"
- Download the JSON file (keep this secure!)
5.2 Configure Botble Admin Panel โ
- Log in to your Botble admin panel
- Go to Settings โ API Settings
- Scroll to Push Notifications (FCM v1 API) section
- Enable Push Notifications
- Enter your Firebase Project ID (found in Firebase Console โ Project Settings โ General)
- Upload the Service Account JSON file you downloaded
5.3 Send Test Notification โ
- In Botble admin, scroll to Send Custom Notification section
- Enter a test title and message
- Select target devices (All Devices, Android Only, iOS Only, or Customers Only)
- Click Send Notification
๐งช Step 6: Test Your Setup โ
After adding both configuration files:
Build and run your app:
- Connect a real device (not simulator)
- Run the app and log in (this registers the device token)
Test notifications from Botble admin:
- Go to your Botble admin panel
- Navigate to Settings โ API Settings
- Scroll to Send Custom Notification
- Enter a test message and send
Alternative: Test from Firebase Console:
- Go to Firebase Console
- Navigate to "Cloud Messaging"
- Click "Send your first message"
- Enter a test message and send
Check if it works:
- You should receive the notification on your device
- If not, check the Troubleshooting section below
โ Troubleshooting โ
Nothing happens when I send a test notification โ
- Make sure you're using a real device (not simulator/emulator)
- Check that you copied the files to the correct folders
- For iOS: Ensure you enabled Push Notifications in Xcode
- Try restarting the app
Where do I find my package name/bundle ID? โ
- Android package name: Look in
android/app/build.gradleforapplicationId - iOS bundle ID: Look in Xcode under your target's General tab
I don't have an Apple Developer account โ
- You need one for iOS push notifications in production ($99/year)
- For testing only, you might be able to use development certificates
No device tokens in Botble admin โ
- Make sure the app is connecting to your Botble API correctly
- Check that users are logged in (device tokens are registered on login)
- Verify API is enabled in Botble settings
๐ Security Notes โ
- Never commit your
google-services.jsonorGoogleService-Info.plistto public repositories - Keep your service account JSON file secure - it has full access to send notifications
- Add Firebase config files to
.gitignoreif your repository is public:
# Firebase config files
android/app/google-services.json
ios/Runner/GoogleService-Info.plist๐ Need More Help? โ
If you're stuck:
- Double-check you followed all steps above
- Make sure file names are exactly
google-services.jsonandGoogleService-Info.plist - Verify files are in the correct folders
- Contact your developer for assistance with technical issues
