FleetbaseFleetbase

Push Notifications

Send order updates, chat messages and offers to the Storefront App's customers — APNs for iOS and FCM for Android, set up in the app and in the Console.

Push Notifications

Customers get push notifications for order updates, messages from the store or their driver, and offers. Tapping one opens what it is about: the order, the chat or the offer. Every notification is also kept in the app's inbox (the bell on the home screen), and customers choose which kinds they want in its settings.

Push needs two things: the app built with push enabled, and a notification channel in the Console with your Apple or Google credentials.

iOS (APNs)

Capability. In Xcode, under Signing & Capabilities, check Push Notifications is present (the app's entitlements and its remote notifications background mode are already set). The bundle id must have Push Notifications enabled in your Apple Developer account.

Key. In Apple Developer → Certificates, Identifiers & Profiles → Keys, create a key with Apple Push Notifications service (APNs). Download the .p8 file (it can only be downloaded once) and note its Key ID and your Team ID.

Channel. In the Console, add a notification channel with scheme apn: the Key ID, Team ID, the app's bundle id, and the contents of the .p8 file. Leave Environment on Auto so one channel serves both development builds and TestFlight / App Store builds.

The iOS Simulator can't receive push from APNs; test on an iPhone.

Android (FCM)

Firebase app. In the Firebase Console, create a project (or use an existing one) and add an Android app with the app's package name (APP_IDENTIFIER).

Config file. Download its google-services.json and put it at android/app/google-services.json. Android builds need this file: they apply the Google Services plugin.

Channel. In Firebase → Project Settings → Service Accounts, generate a private key. In the Console, add a notification channel with scheme fcm and paste the whole service-account JSON.

Where channels go

Put channels on the store for a single store's app, and on the Network for a marketplace app; a Network's channels serve the customers of every member store. The full field reference, the order channels are tried in, and the Send test button are in Notification Settings.

How the app registers

The app asks for permission to send notifications when it first opens (on Android 13 and later this is the system prompt). Once the customer is signed in, it registers the device's token with Storefront (POST customers/register-device), and unregisters it when they sign out, so a shared phone stops getting the previous customer's notifications. Tokens Apple or Google report as no longer valid are dropped automatically. See Customer Notifications.

Sending your own

Beyond order and chat updates, you can send offers and announcements to customers, or to a segment of them, from the Console. See Push Notifications under Promotions.

Troubleshooting

SymptomLikely cause
Nothing arrives on iOSNo APNs channel for the store or Network the app is built with; or the bundle id on the channel doesn't match the app
iOS works from Xcode but not TestFlight (or the reverse)Channel environment set to Production or Sandbox only; use Auto
Nothing arrives on AndroidService account from a different Firebase project than google-services.json
Android build fails on google-servicesandroid/app/google-services.json missing
A customer gets nothingThey turned notifications off on the phone, or for that kind in the app's notification settings

Use Send test on the channel with a token from the phone to see Apple's or Google's own answer.

Push Notifications | Fleetbase