Set up Android and iOS push
Connect Firebase Cloud Messaging with a service account JSON and Apple Push Notification service with a .p8 key, step by step, in Push → Setup.
Open your app in the dashboard and choose Push → Setup. Connect each platform once: Android with a Firebase service account, iOS with an APNs key. CodeOnAir checks each file with Google or Apple before saving it, and stores it encrypted. Only admins and the owner can upload them.
Android: Firebase service account#
Android notifications go through Firebase Cloud Messaging (FCM). CodeOnAir sends them on your behalf with a service account key — a JSON file from your Firebase project.
- Open the Firebase console and choose the project your Android app uses — the one its
android/app/google-services.jsonwas downloaded from. No Firebase project yet? Click Create a project, then add an Android app with your package name (e.g.com.demoshop.app) and downloadgoogle-services.json. - Click the gear icon next to Project Overview → Project settings → the Service accounts tab.
- Under Firebase Admin SDK, click Generate new private key, then Generate key. A JSON file downloads (its name looks like
your-project-firebase-adminsdk-xxxxx.json). - In CodeOnAir, Push → Setup → the Android card: drop the JSON file on Upload service account JSON (or click to choose it), then Check & save. The card shows Connected and your Firebase project ID.
If the check fails
- Not a service account file — make sure you uploaded the Admin SDK key from Service accounts, not
google-services.json(that one goes inside the app). - Google rejects the key — it was deleted or disabled in Google Cloud. Generate a new key and upload it.
- Sends fail with SENDER_ID_MISMATCH — the app was built with a
google-services.jsonfrom a different Firebase project than the service account. Use the same project for both. - In Firebase console → Project settings → Cloud Messaging, Firebase Cloud Messaging API (V1) must be enabled (it is by default for new projects).
iOS: APNs key#
iOS notifications go through Apple Push Notification service (APNs). CodeOnAir uses a token-based APNs authentication key (a .p8 file). One key works for every app in your Apple Developer team, for both development and App Store builds, and it doesn't expire.
- Sign in to developer.apple.com/account (you need the Account Holder or Admin role) → Certificates, Identifiers & Profiles → Keys → the + button.
- Enter a key name (e.g. “CodeOnAir push”), tick Apple Push Notifications service (APNs). If Apple asks you to configure it, choose the environment Sandbox & Production. Click Continue, then Register.
- Click Download. You get
AuthKey_XXXXXXXXXX.p8— Apple lets you download it only once, so keep it somewhere safe. The 10-character Key ID is on the same page (and in the file name). - Find your Team ID: developer.apple.com/account → Membership details (10 characters, e.g.
A1B2C3D4E5). - Find your app's Bundle ID: Xcode → your target → General → Bundle Identifier (e.g.
com.demoshop.app). - In CodeOnAir, Push → Setup → the iOS card: drop the
.p8file on the upload area. The Key ID fills in from the file name; Team ID and Bundle ID are pre-filled from your URL prefix setup if you did it. Check all three, then Check & save.
If the check fails
- InvalidProviderToken — the Key ID or Team ID doesn't match the key. Both are 10 characters; copy them again from Apple.
- DeviceTokenNotForTopic or BadDeviceToken when sending — the Bundle ID here isn't the app's bundle ID.
- TopicDisallowed — the key belongs to a different team than the app.
Prepare your app#
These steps are the same for any push service, so you can do them now:
Android
- Put
google-services.json(Firebase console → Project settings → General → Your apps → your Android app) inandroid/app/. - Android 13 and newer asks the user to allow notifications, so the app needs the
android.permission.POST_NOTIFICATIONSpermission inAndroidManifest.xml.
iOS
- Xcode → your target → Signing & Capabilities → + Capability → Push Notifications.
- Add Background Modes as well and tick Remote notifications.
- With automatic signing Xcode turns on Push Notifications for your App ID. With manual signing, enable it at developer.apple.com → Identifiers → your app → Push Notifications, and regenerate the provisioning profiles.
Devices appear in CodeOnAir once your app runs the CodeOnAir push SDK for React Native, @codeonair/push-react-native, which registers the install, asks for notification permission, reports opens and draws in-app messages. It isn't released yet — we'll publish its setup guide here when it is. You can already connect Firebase and APNs, design messages and wire up your server.
The setup checklist#
| Step | Turns green when |
|---|---|
| Android: Firebase service account | A service account has been checked with Google and saved. |
| iOS: APNs key | An APNs key has been checked with Apple and saved. |
| SDK in your app | At least one install has opened the app with the SDK. |
| A device allowed notifications | At least one device said yes to the permission prompt and has a push token. |
Disconnect on a card removes that platform's credentials: notifications stop reaching those devices until you upload again.