Skip to content
Providers

Firebase Cloud Messaging and APNs

Create an FCM sending service account, upload your APNs key into Firebase, and connect both to AppCore for push on Android and iOS.

On this page

AppCore sends push notifications through Firebase Cloud Messaging (FCM) HTTP v1 for both Android and iOS. For iOS, FCM forwards to Apple Push Notification service (APNs) using an APNs key that you upload into Firebase. You therefore set up two AppCore connections:

  • firebase_fcm: the Firebase project and a dedicated service account that may send messages.
  • apple_apns: the identifiers of your APNs key, plus evidence that it is uploaded to Firebase. Storing the key itself in AppCore is optional.

Push payloads carry only intent_id, content_ref and category; the app fetches the message body over an authenticated call, so lock-screen content never contains personal data. Console paths are as of 2026-11.

Warning

Not yet enabled:

  • Operator test send from the console or SDK. The runtime implements pairing a test device and sending it a test push, but the routes are not in the published API contract and the console and SDK do not call them yet. See Getting started, step 8 for the interim API calls.
  • Topic broadcasts (one message to every device). Only per-user sends exist.
  • Keyless (federated) credentials. credential_mode must be service_account_key.
  • Direct APNs is off by default; iOS goes through FCM. Your platform operator can enable direct APNs per environment, in which case the .p8 key in the apple_apns connection is used.

Before you begin

  • A Firebase project for this environment, with your Android app (package name) and iOS app (bundle ID) registered in it. Firebase project Owner or Editor; Project IAM Admin to grant roles.
  • Apple Developer Account Holder or Admin to create the APNs key.
  • Your iOS App ID has the Push Notifications capability enabled.

Steps

Firebase sender (firebase_fcm)

  1. Find project and app IDs. Firebase console → project → ⚙ Project settings → General. Copy the Project ID (not the project number). Under Your apps, copy the Android App ID and the Apple App ID (they look like 1:1234567890:android:…).
  2. Download client config. In the same page, download google-services.json (Android) and GoogleService-Info.plist (iOS) into the matching build flavor. These are public client configuration, not secrets. Never put a service-account key in the app.
  3. Check the API. Google Cloud console (same project) → APIs & Services → Enabled APIs & services: confirm Firebase Cloud Messaging API (V1) is enabled.
  4. Create a dedicated sender. Google Cloud console → IAM & Admin → Service Accounts → Create service account. Name it, for example appcore-fcm-sender. Grant it the role Firebase Cloud Messaging API Admin (roles/firebasecloudmessaging.admin). Do not reuse the Google Play billing service account or the default firebase-adminsdk account: they carry broader rights and must rotate independently.
  5. Create its key. Open the service account → Keys → Add key → Create new key → JSON. The file downloads once.
  6. In AppCore, open Setup and connections → Connections, create a Firebase Cloud Messaging connection, fill in the public fields, then paste the whole JSON file into service_account_key_json and delete the local copy.
  7. Run Check syntax, then Read-only check, then Activate.

APNs key (apple_apns)

  1. Create the key. developer.apple.com → Account → Certificates, Identifiers & Profiles → Keys → ➕. Name it, tick Apple Push Notifications service (APNs), then Continue → Register → Download. The .p8 downloads once. Note the Key ID and your Team ID (Account → Membership details).
  2. Upload it to Firebase. Firebase console → ⚙ Project settings → Cloud Messaging → Apple app configuration → your iOS app → APNs Authentication Key → Upload. Select the .p8, enter the Key ID and Team ID. One APNs key serves both the sandbox and production APNs environments.
  3. Enable capabilities in Xcode: Push Notifications, and Background Modes → Remote notifications.
  4. In AppCore, create an Apple push key for FCM connection and fill in the public fields. Leave private_key_p8 empty unless your operator enabled direct APNs. Then delete the local .p8 (Firebase keeps it).
  5. Run Check syntax. There is no automated check for APNs: attest check apns-upload (stage read_only) with a note naming the Key ID shown in Firebase, via POST /v1/connections/{connection_id}/evidence. Then Activate.
  6. Back in the firebase_fcm connection, set apns_connection_ref to the apple_apns connection ID and save.

In the app

Dart
await core.messaging.attach(FcmPushBridge());
// Ask in context (for example after the user taps "Enable notifications"):
final permission = await core.messaging.requestPermission(); // registers the device when signed in

The device token is stored encrypted and is never returned by any API. Logging out detaches the device.

Paste into AppCore

Firebase Cloud Messaging (firebase_fcm)

AppCore fieldWhere to find itSecret?
project_idFirebase → Project settings → General → Project IDPublic
android_app_idProject settings → General → Your apps → Android → App IDPublic
ios_app_idProject settings → General → Your apps → Apple → App IDPublic
platforms["android","ios"], only platforms registered in this projectPublic
credential_modeservice_account_keyPublic
service_account_emailIAM & Admin → Service Accounts → your sender's Email. Must equal client_email in the JSON keyPublic
service_account_key_jsonThe JSON key file from step 5, whole contentsSecret (write-only)
apns_connection_refAppCore → Connections → Apple push key for FCM → connection IDPublic
native_public_configNote which google-services.json / GoogleService-Info.plist this build ships (public values only)Public
federation_configurationLeave empty (not used)Public

Apple push key for FCM (apple_apns)

AppCore fieldWhere to find itSecret?
team_idApple Developer → Membership details → Team IDPublic
key_idKeys → your APNs key → Key IDPublic
bundle_idIdentifiers → your App ID → Bundle IDPublic
firebase_ios_app_idFirebase → Project settings → General → Your apps → Apple → App IDPublic
firebase_upload_evidenceFirebase → Project settings → Cloud Messaging → Apple app configuration: note that the key (Key ID, Team ID) shows as uploadedPublic
private_key_p8The APNs .p8. Optional: only when your operator enables direct APNsSecret (write-only)

Verify

  • Read-only check on firebase_fcm passes with FCM_VALIDATE_ONLY_ACCEPTED: AppCore minted a short-lived token from your key and asked FCM to validate (not deliver) a message to a topic.
  • After Activate, push appears in messaging_channels of GET https://<your-api-host>/v1/config/public, and registered devices appear in Messaging and engagement → Devices and inbox.
  • Send a test push to your own paired device and confirm it in the foreground, background and terminated states on Android and iOS. Record the result as evidence for fcm-sandbox and apns-device (stage sandbox), and attest fcm-negative. The connection then becomes sandbox_ready.
  • In development and staging, regular pushes (not test sends) go out only once firebase_fcm is sandbox_ready. Until then they are not sent; devices still register and the inbox still works.
  • Delivery records in Messaging and engagement → Deliveries show accepted when FCM accepted a message. FCM gives no proof that a notification was displayed.

Troubleshooting

SymptomLikely causeFix
Read-only check PROVIDER_PERMISSION_MISSINGThe service account lacks cloudmessaging.messages.createGrant Firebase Cloud Messaging API Admin on this project
PROJECT_NOT_FOUNDWrong Project ID, or FCM API (V1) disabledUse the Project ID (not number); enable the API
INVALID_SERVICE_ACCOUNT_JSON / INVALID_SERVICE_ACCOUNT_KEYNot the full JSON key filePaste the whole file as downloaded
PROVIDER_AUTH_REJECTEDKey deleted or service account disabledCreate a new key and Rotate
Check passes but nothing is ever sentservice_account_email does not match client_email in the key; AppCore then treats push as unconfiguredMake the two equal
Android receives, iOS does notAPNs key not uploaded to Firebase, Push Notifications capability missing, or wrong bundleRedo the APNs steps; rebuild with the capability
Token marked invalid after a sendFCM answered UNREGISTERED / SENDER_ID_MISMATCH (app reinstalled, or built against another Firebase project)Expected; the app re-registers on next launch. Check the flavor ships this project's config files
push missing from messaging_channelsConnection not active, or push disabled for this environment by your operatorActivate; ask your operator