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_modemust beservice_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
.p8key in theapple_apnsconnection 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)
- 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:…). - Download client config. In the same page, download
google-services.json(Android) andGoogleService-Info.plist(iOS) into the matching build flavor. These are public client configuration, not secrets. Never put a service-account key in the app. - Check the API. Google Cloud console (same project) → APIs & Services → Enabled APIs & services: confirm Firebase Cloud Messaging API (V1) is enabled.
- 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 defaultfirebase-adminsdkaccount: they carry broader rights and must rotate independently. - Create its key. Open the service account → Keys → Add key → Create new key → JSON. The file downloads once.
- 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_jsonand delete the local copy. - Run Check syntax, then Read-only check, then Activate.
APNs key (apple_apns)
- Create the key. developer.apple.com → Account → Certificates, Identifiers & Profiles → Keys → ➕. Name it,
tick Apple Push Notifications service (APNs), then Continue → Register → Download. The
.p8downloads once. Note the Key ID and your Team ID (Account → Membership details). - 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. - Enable capabilities in Xcode: Push Notifications, and Background Modes → Remote notifications.
- In AppCore, create an Apple push key for FCM connection and fill in the public fields. Leave
private_key_p8empty unless your operator enabled direct APNs. Then delete the local.p8(Firebase keeps it). - Run Check syntax. There is no automated check for APNs: attest check
apns-upload(stageread_only) with a note naming the Key ID shown in Firebase, viaPOST /v1/connections/{connection_id}/evidence. Then Activate. - Back in the
firebase_fcmconnection, setapns_connection_refto theapple_apnsconnection ID and save.
In the app
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 inThe 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 field | Where to find it | Secret? |
|---|---|---|
project_id | Firebase → Project settings → General → Project ID | Public |
android_app_id | Project settings → General → Your apps → Android → App ID | Public |
ios_app_id | Project settings → General → Your apps → Apple → App ID | Public |
platforms | ["android","ios"], only platforms registered in this project | Public |
credential_mode | service_account_key | Public |
service_account_email | IAM & Admin → Service Accounts → your sender's Email. Must equal client_email in the JSON key | Public |
service_account_key_json | The JSON key file from step 5, whole contents | Secret (write-only) |
apns_connection_ref | AppCore → Connections → Apple push key for FCM → connection ID | Public |
native_public_config | Note which google-services.json / GoogleService-Info.plist this build ships (public values only) | Public |
federation_configuration | Leave empty (not used) | Public |
Apple push key for FCM (apple_apns)
| AppCore field | Where to find it | Secret? |
|---|---|---|
team_id | Apple Developer → Membership details → Team ID | Public |
key_id | Keys → your APNs key → Key ID | Public |
bundle_id | Identifiers → your App ID → Bundle ID | Public |
firebase_ios_app_id | Firebase → Project settings → General → Your apps → Apple → App ID | Public |
firebase_upload_evidence | Firebase → Project settings → Cloud Messaging → Apple app configuration: note that the key (Key ID, Team ID) shows as uploaded | Public |
private_key_p8 | The APNs .p8. Optional: only when your operator enables direct APNs | Secret (write-only) |
Verify
- Read-only check on
firebase_fcmpasses withFCM_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,
pushappears inmessaging_channelsofGET 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-sandboxandapns-device(stagesandbox), and attestfcm-negative. The connection then becomessandbox_ready. - In development and staging, regular pushes (not test sends) go out only once
firebase_fcmissandbox_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
| Symptom | Likely cause | Fix |
|---|---|---|
Read-only check PROVIDER_PERMISSION_MISSING | The service account lacks cloudmessaging.messages.create | Grant Firebase Cloud Messaging API Admin on this project |
PROJECT_NOT_FOUND | Wrong Project ID, or FCM API (V1) disabled | Use the Project ID (not number); enable the API |
INVALID_SERVICE_ACCOUNT_JSON / INVALID_SERVICE_ACCOUNT_KEY | Not the full JSON key file | Paste the whole file as downloaded |
PROVIDER_AUTH_REJECTED | Key deleted or service account disabled | Create a new key and Rotate |
| Check passes but nothing is ever sent | service_account_email does not match client_email in the key; AppCore then treats push as unconfigured | Make the two equal |
| Android receives, iOS does not | APNs key not uploaded to Firebase, Push Notifications capability missing, or wrong bundle | Redo the APNs steps; rebuild with the capability |
| Token marked invalid after a send | FCM 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_channels | Connection not active, or push disabled for this environment by your operator | Activate; ask your operator |