Getting double notifications on Android using OneSignal.

We have moved to OneSignal for the push notifications service. Implemented it for Android and IOS and using the official plugin for Solar2D. We are correctly getting a single push notification on IOS but getting two notifications on Android. We have removed all the references of the other push service we were using and unsubscribed all the users from them just to be sure there’s no other service messing up.

The first notification is with a default title and message and the other is without a title and just the message. We are not using any additional field data. But we realised, if we use fields then the notification with a title contained this field and value but the one without a title doesn’t contain this additional field.

@josh_OneSignal Can you please shed some light on this topic? Any help will be appreciated.

Did you ever figure this out? My Android players are also getting duplicates. Not doing anything fancy. Super basic with only a title + message.

If you’re using the notifications v2 plugin then you’ll need to prevent the firebase code from also receiving the notifications:

.registerForPushNotifications(useFCM=false)

The documentation says this is ios only so it’s easy to ignore it on Android but this fixed it for us.

Thanks so much! The forums didn’t seem too active so I wasn’t expecting a quick reply. Will try it out and hopefully it works :slight_smile:

Edit: disregard below. It seems like OneSignal is causing a crash at launch on Android, but I can’t seem to figure out why. Stripped out OneSignal to only call Init() and it still happens. Wasn’t an issue with builds from a couple months ago, so something must have changed in one of the recent builds. Anyone else experiencing this?

Following up on this:

The above fix/solution no longer works in the latest versions of Solar2D and will crash your game upon launch. Removing that 1 line fixes the crash issue.

I’m not sure if there’s a new way to prevent the duplicate notifications or if OneSignal has changed something on their end to fix this.