Apple acknowledged a bug in iOS 17 that caused duplicates. This was fixed in iOS 17.3. Read more.
Start here
Pick the section that best matches your situation:- Your server retries failed API calls or your backend pipeline may double-send → Same message sent multiple times
- Your app uses Firebase or another push SDK alongside OneSignal → Third-party notification handlers
- Your Android app customizes notifications in code (service extension or foreground listener) → Android notification handlers
- Your iOS app implements its own
UNUserNotificationCenterDelegate→ iOS foreground handler - You only see duplicates on dev builds or with multiple installs → Multiple app instances
Same message sent multiple times
The most common cause is sending the same notification payload more than once through the OneSignal API. Common reasons:- Your server retries requests without checking if the first succeeded.
- Logic in your backend pipeline sends the same notification twice.
- You’re migrating to OneSignal but still sending from a previous provider. Avoid sending from both systems at the same time.
Idempotent API requests
Prevent duplicate messages by reusing idempotency keys on retries.
Third-party notification handlers
Duplicates can occur when other code in your app processes OneSignal’s push payload and displays its own notification in addition to OneSignal’s. This includes:- Other remote push SDKs (for example, Firebase Cloud Messaging) that receive the same payload.
- Custom message handlers such as a
FirebaseMessagingServiceon Android or aUNUserNotificationCenterDelegateon iOS that read the incoming payload and build a local notification from it.
Identifying OneSignal notifications
Every OneSignal notification includes acustom object with an i key containing the OneSignal notification UUID:
JSON
Filtering OneSignal notifications from third-party handlers
In any non-OneSignal handler, check for thecustom.i key and return early when it is present. OneSignal then handles its own payloads while your other code continues to process its own.
- Android
- iOS
In a custom
FirebaseMessagingService or other remote message handler:Kotlin
Android notification handlers
OneSignal exposes two Android callbacks that let you intercept and customize a notification before it displays:onNotificationReceivedin a notification service extension — runs for every push, including when the app is in the background.onWillDisplayin a foreground lifecycle listener — runs only when the app is in the foreground.
The preventDefault() and display() rule
OneSignal displays each notification automatically unless you suppress it with event.preventDefault(). Two common mistakes cause duplicates:
- Calling
event.getNotification().display()without first callingevent.preventDefault()— shows the notification twice. - Posting a separate notification with
NotificationManagerCompat.notify()while OneSignal also displays the original.
display() or your own NotificationManagerCompat.notify(), never both.
onWillDisplay in a foreground lifecycle listener:
Kotlin
Async work inside callbacks
When you do background work (network calls, database lookups) before displaying, callpreventDefault() synchronously in the callback and call display() only after the async work completes. Returning from the callback without preventDefault() lets OneSignal display the notification, and a later display() call produces a duplicate.
iOS foreground handler
OneSignal sets itself as theUNUserNotificationCenterDelegate during SDK initialization. If your app also implements foreground notification handling, the notification can display twice — once from OneSignal and once from your code.
Common patterns that cause duplicates:
- Implementing your own
UNUserNotificationCenterDelegatewithout forwarding calls to OneSignal, then callingcompletionHandler([.banner, .sound])and showing a custom in-app alert from the same method. - Scheduling a local notification (
UNUserNotificationCenter.current().add(...)) in response to an incoming push that OneSignal is also displaying.
event.preventDefault() when you want to render the notification yourself:
Swift
Multiple app instances
- Android
- iOS
- Web
Duplicates can happen when you have both production and development versions of your app installed. Each app has a unique package name and receives its own push token.Long-press the notification to confirm which app instance sent it.
Diagnostic tips
To debug duplicates faster, collect and send the following to OneSignal support:- OneSignal Subscription ID of the device that received the duplicates
- OneSignal Message ID or a link to the message in the dashboard
- List of other libraries or plugins in your app
- Debug log reproducing the issue
- Detailed reproduction steps
FAQ
What happens if I have two notification SDKs in my app?
Both SDKs may independently process and display the same notification. OneSignal filters its own notifications automatically, but other SDKs do not. Filter OneSignal payloads out of your other SDK’s handlers by checking for thecustom.i key. See Third-party notification handlers for code examples.
How do I send push from a previous provider and OneSignal at the same time?
You can transition gradually, but avoid sending the same message from both providers.- Android: Remove old SDK notification handling code when integrating OneSignal and releasing the app. As users update, they stop receiving push from the old provider.
- iOS: You can continue sending from the old provider temporarily while users update. Once fully transitioned, send from OneSignal only to avoid duplicates.
How do I prevent multiple notifications for rapidly-changing updates?
Use acollapse_id in the Create notification API to replace previous notifications instead of stacking them. When multiple notifications share the same collapse_id, each new one replaces the previous notification in the tray. This is useful for stock price updates, live scores, delivery ETAs, and similar frequent updates.
Related pages
Mobile SDK troubleshooting
Resolve common issues with push notification delivery on iOS and Android.
Web push troubleshooting
Debug web push subscription, service worker, and delivery issues.
In-app message troubleshooting
Fix issues with in-app message display, triggers, and duplicates.
Mobile service extensions
Intercept and customize push notifications before display on iOS and Android.
Notifications not shown (web)
Troubleshoot web push notifications that are sent but not displayed.