Skip to content
CodeOnAir
Docs menu

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.

Push → Setup with Android connected and iOS still to do. The checklist on top turns green as each part works.

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.

  1. Open the Firebase console and choose the project your Android app uses — the one its android/app/google-services.json was 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 download google-services.json.
  2. Click the gear icon next to Project Overview → Project settings → the Service accounts tab.
  3. 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).
  4. 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.
Important
The service account file is a password for your Firebase project. Upload it here and keep it out of your app, your repository and chat. If it ever leaks, delete the key in Google Cloud console → IAM & Admin → Service accounts → Keys, generate a new one and upload it again.

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.json from 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.

  1. Sign in to developer.apple.com/account (you need the Account Holder or Admin role) → Certificates, Identifiers & Profiles → Keys → the + button.
  2. 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.
  3. 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).
  4. Find your Team ID: developer.apple.com/account → Membership details (10 characters, e.g. A1B2C3D4E5).
  5. Find your app's Bundle ID: Xcode → your target → General → Bundle Identifier (e.g. com.demoshop.app).
  6. In CodeOnAir, Push → Setup → the iOS card: drop the .p8 file 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.
Tip
Development builds from Xcode get “sandbox” push tokens and App Store / TestFlight builds get production ones. You don't choose: CodeOnAir tries the right APNs environment for each device and remembers it. Devices running a development build show a debug build badge under Devices.

Prepare your app#

These steps are the same for any push service, so you can do them now:

Android

  1. Put google-services.json (Firebase console → Project settings → General → Your apps → your Android app) in android/app/.
  2. Android 13 and newer asks the user to allow notifications, so the app needs the android.permission.POST_NOTIFICATIONS permission in AndroidManifest.xml.

iOS

  1. Xcode → your target → Signing & Capabilities → + Capability → Push Notifications.
  2. Add Background Modes as well and tick Remote notifications.
  3. 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.
The app SDK is coming soon

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#

StepTurns green when
Android: Firebase service accountA service account has been checked with Google and saved.
iOS: APNs keyAn APNs key has been checked with Apple and saved.
SDK in your appAt least one install has opened the app with the SDK.
A device allowed notificationsAt 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.

Stuck? Write to support@codeonair.com with your App ID and what you tried — we reply within a working day.