Skip to content
Winter Sale from $619, until 31st December 2026 Book now
Playbooks for AI-built app releases iOS + Android

Push Notifications in AI-Built Apps: What the Agent Writes and What You Set Up

A coding agent can write the registration code, the token endpoint and the sending function for push notifications – but it cannot create your APNs key, own your Firebase project or decide what you are allowed to send. Push works when you split it that way: you set up credentials and consent rules, the agent builds the plumbing, and you test delivery on real devices with release builds.

8 min read

Key takeaways

  • Push spans four places – app code, Apple and Google consoles, your backend and the permission state on the device – and an agent only sees the first and third.
  • Create the APNs authentication key and the Firebase service account yourself and store them as server secrets; they never belong in the app bundle.
  • Apple does not allow push to be required for the app to work, and marketing pushes need explicit opt-in plus an in-app opt-out.
  • Test with TestFlight and Play-signed release builds: they use the production push environment, which is where most agent-built setups fail.

Why push is the feature agents get half right

Ask a coding agent to "add push notifications" and you usually get convincing code within minutes: a permission request, a call that registers for remote notifications, a handler that shows a banner. In the simulator or a debug build, a test notification may even arrive. Then the first TestFlight build goes out and nothing happens.

The reason is structural. A working push setup depends on four things, and the agent can only reach two of them:

  • App code – registration, permission prompt, token handling, tap routing. The agent writes this well.
  • Your backend – storing device tokens per user and sending messages. The agent can write this too.
  • Apple and Google consoles – the APNs key, the app's push capability, the Firebase project. These need your accounts.
  • The device – whether the user allowed notifications, which push environment the build talks to, whether the token changed. Only real testing tells you.

Plan the feature with that split in mind and push stops being a mystery.

The moving parts on iOS and Android

PieceiOSAndroidWho sets it up
Credential for sendingAPNs authentication key (.p8) from your Apple Developer accountFirebase project with a service account for the FCM HTTP v1 APIYou – then stored as a server secret
App capabilityPush Notifications capability, which adds the aps-environment entitlementFirebase Messaging dependency and a messaging service in the manifestAgent, with your review of the entitlement diff
PermissionSystem prompt, asked once – a "no" is hard to undoPOST_NOTIFICATIONS runtime permission on Android 13 and later, plus notification channelsAgent writes it; you decide when it appears
Config filesGoogleService-Info.plist if you use Firebase on iOSgoogle-services.jsonYou download, agent wires in
SendingYour server or a serverless function calls APNs or FCM with the tokenAgent writes it; secrets come from your secret store

Many teams use Firebase Cloud Messaging for both platforms: you upload the APNs key to Firebase once, and your backend talks to a single API. Cross-platform stacks such as Expo also offer their own push service on top of APNs and FCM. Either is fine – what matters is that the sending credential lives on a server.

One trap specific to agents: models trained on older examples still produce code for the retired FCM server-key API. If you see a "server key" in a generated sending function, ask for the HTTP v1 API with a service account instead.

Talk to an AI Code Engineer about shipping your app to the App Store and Google Play.

In a free call we look at what you built, tell you honestly what stands between it and an approved release – and whether you need us at all.

What to hand the agent – with a task brief

Once the credentials exist, the code side is a good agent task, as long as the brief is specific. Vague prompts produce an app that asks for notification permission on the first launch screen and never handles a tapped notification. A brief that works looks like this:

Add push notifications (iOS + Android) using FCM.
- Ask for permission only after the user creates their first reminder,
  with a short in-app explanation screen before the system prompt.
- Send the device token to POST /devices with the user's session;
  replace it when it changes; delete it on logout.
- Tapping a notification opens the screen in payload.route.
- Android: one channel "Reminders", default importance.
- Server: function sendReminder(userId) using the FCM HTTP v1 API;
  credentials from the FCM_SERVICE_ACCOUNT secret, never from the app.
- Remove tokens that FCM reports as unregistered.
- Do not change entitlements, signing or bundle IDs beyond adding
  the push capability. Show me the plan first.

Ask for the plan before the code, then check two things in the diff yourself: the entitlement and manifest changes, and where the sending credential is read from. The rest – foreground handling, badge counts, deep-link routing, channel setup – is ordinary code review. Our playbook on secrets and API keys in AI-built apps explains why the service account must never end up in the client.

Store rules that shape the feature

Apple's App Review Guidelines (4.5.4) say push notifications must not be required for the app to function, must not carry sensitive personal or confidential information, and may only be used for promotions or direct marketing if users explicitly opted in through consent language in your app and can opt out inside the app. In practice that means:

  • The app keeps working when the user denies the permission – no blocking screen that demands notifications.
  • Marketing messages get their own toggle, off by default, separate from transactional notifications such as reminders or order updates.
  • Payloads contain references ("You have a new message"), not health data, balances or message contents.

Push also touches your privacy answers. Device tokens are identifiers, and whatever you send through a third-party service is data you share with it. Update the App Privacy section and the Google Play Data safety form when you add push – our guides on privacy manifests with AI agents and the Data safety form with AI agents show how to let the agent inventory the SDKs while you answer the questions. If a permission was pulled in that you do not need, read the sensitive permissions guide.

Testing push: the cases agents never try

The most common report we hear is "push works in development but not in TestFlight". Builds installed from Xcode talk to the APNs development environment; TestFlight and App Store builds use production. If the backend sends everything to the sandbox endpoint, or the key is only configured for one environment, release builds stay silent. On Android, the equivalent surprise is a release build with code shrinking that behaves differently from the debug build.

Run this matrix with real devices and release builds – TestFlight on iOS, the internal testing track on Android:

  • app in foreground, in background and fully closed,
  • permission denied, then allowed later in system settings,
  • reinstall (the token changes) and a second device for the same user,
  • logout – the old device must stop receiving that user's messages,
  • tap on a notification for a screen behind login,
  • Android 13 or later, where notifications are off until the user agrees.

Write each failure up as a separate task for the agent with the device, build number and steps. An agent cannot watch a phone's lock screen; it can fix a bug you describe precisely.

When to hand it off

Push is a feature where an hour with someone who has set it up many times saves days of guessing. Our AI Code Engineers create the keys in your accounts, wire APNs and FCM into your pipeline and check the privacy answers before submission – see the iOS and Android submission services. If you also sell subscriptions, read in-app purchases in AI-built apps next; renewal and billing notices are often the first pushes an app sends.

Push notification checklist for agent-built apps

  • APNs key and Firebase service account created by the account holder and stored only as server secrets.
  • Push capability added on iOS; the entitlement diff reviewed by a human.
  • Permission asked in context, with an explanation screen – and the app works when it is denied.
  • Marketing notifications have explicit opt-in and an in-app opt-out.
  • Tokens are stored per user, replaced on change, removed on logout and cleaned up when invalid.
  • Sending code uses the FCM HTTP v1 API or APNs token authentication, not a legacy server key.
  • Delivery tested with TestFlight and internal-track release builds on real devices.
  • App Privacy answers and the Data safety form updated for push tokens and payload data.

Frequently asked questions

Can a coding agent create my APNs key or Firebase project?

No. Both live in accounts that need your identity – the Apple Developer account and your Google account. You create the key or service account, store it as a secret, and the agent writes code that reads it by name.

Why do notifications arrive in debug builds but not in TestFlight?

Debug builds from Xcode use the APNs development environment, TestFlight and App Store builds use production. Check that your backend or Firebase sends to production for release builds and that the key is set up for it.

Do I need Firebase on iOS?

No. You can send directly to APNs from your server. Firebase Cloud Messaging is convenient when you want one sending API for iOS and Android, but it is an extra SDK that you must declare in your privacy answers.

Can you add push notifications to our agent-built app?

Yes. Book a free call and an AI Code Engineer looks at your stack with you. We can set up the credentials and pipeline in your accounts and review what your agent built before it goes to the stores.

Free, 15 minutes, no obligation

Get your app from agent output to approved release.

Our AI Code Engineers take apps built with Claude Code, Codex, Cursor, Lovable, Base44 and co. through signing, CI/CD, store listings and review – in your own developer accounts.

AI tools, store policies and requirements change quickly – always check the current documentation of the tools and stores you use. This article is independent advice and not affiliated with or endorsed by Apple, Google, Anthropic, OpenAI or any other company or product mentioned; all trademarks belong to their owners.

Ready to ship?

Talk to an AI Code Engineer – free, 15 minutes, in English or German.

Book a call for free

Chat and hotline are open 24/7. Answers from our senior AI Code Engineers (real humans) usually take closer to 72 hours than 1 hour.