Prompt
How do I set up push notifications for iOS and Android with one API?
Latest observation
Oct 14, 2026
OpenAI APIWeb search: off
The usual way to do this is to use a push notification service/abstraction layer so your app talks to one API, while the service handles the platform-specific details for APNs (iOS) and FCM (Android).
Common options
- Firebase Cloud Messaging (FCM)
- Good for Android, and can also deliver to iOS through APNs.
- Often the simplest “single API” if you already use Firebase.
- OneSignal
- Very easy to integrate.
- One API for iOS + Android.
- Includes dashboards, segmentation, scheduling, etc.
- AWS SNS / Pinpoint
- Good if you’re already on AWS.
- Pusher Beams / Airship / Mixpanel Engage / Braze
- More advanced marketing/product messaging platforms.
Recommended architecture
-
Mobile app
- Registers for notifications.
- Gets a device token:
- iOS: APNs token
- Android: FCM token
- Sends token to your backend with user/session info.
-
Your backend
- Stores each user’s push tokens.
- Uses one provider API (e.g., OneSignal or FCM) to send notifications.
- Optionally groups tokens by user, segment, locale, etc.
-
Provider
- Routes to APNs for iOS and FCM for Android behind the scenes.
Setup steps
1) Configure platform credentials
- iOS
- Enable Push Notifications capability in Xcode.
- Create an APNs auth key in Apple Developer.
- Upload APNs credentials to your chosen push provider.
- Android
- Create/configure Firebase project.
- Add
google-services.jsonto your Android app. - Enable FCM.
2) Add SDKs
- Add the provider’s SDK to both apps.
- Initialize it on app startup.
3) Request notification permission
- iOS requires user permission prompt.
- Android 13+ also requires runtime permission for notifications.
4) Register and sync tokens
- On token refresh, send the new token to your backend/provider.
5) Send notifications from one API
Example payload conceptually:
{
"target_user_id": "123",
"title": "New message",
"body": "You have a new message",
"data": {
"screen": "inbox",
"thread_id": "abc"
}
}
If you want the simplest single-API solution
Use OneSignal:
- One API for both iOS and Android
- Minimal backend work
- Easy token/device management
If you want to build it yourself
Use FCM as your unified layer:
- Android uses FCM directly
- iOS can also be addressed via FCM, but you still need APNs set up underneath
- Your backend sends to FCM only
Important gotchas
- Handle token rotation
- Remove invalid/expired tokens
- Use collapse keys / notification grouping to avoid spam
- Separate notification payload (displayed automatically) vs data payload (handled by app)
- Respect iOS background delivery limitations
If you want, I can give you:
- a step-by-step setup for OneSignal,
- a DIY setup with FCM + APNs, or
- example code for backend + iOS + Android.