OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
592 stars 368 forks source link

[Bug]: User data is not up-to-date after downgrading SDK 5 to 4 #2115

Open bundleberk opened 3 weeks ago

bundleberk commented 3 weeks ago

What happened?

We had to downgrade OneSignal SDK from 5 to 4 because of the #2070 issue. We first downgraded it to 4.8.9. After that because of #2078 this issue we again downgraded it to 4.8.4 because we were using HiltWorker which requires a custom configuration and initializing workmanager manually. This was causing a crash on 4.8.9.

After doing those and releasing the app, we started monitoring a huge decrease in our in app message impressions and confirmed delivery counts. Also, even though a friend of mine is using the app actively, when I check his data on onesignal panel his last session is set to a month ago (just before we downgraded onesignal to 4.8.9 and added workmanager), the onesignal sdk version is still 5 (even if it is 4.8.4 now) and the app version is also wrong. He is still seeing notifications and in app messages but we cannot see the data on onesignal panel when he clicks a notification.

I guess the SDK is sending those data via workmanager to onesignal backend and something is broken about that after the steps we took.

Steps to reproduce?

What we did was:

1- Create an app with onesignal 5.1.8
2- Downgrade it to onesignal 4.8.9 and manually initialize workmanager.
3- Downgrade onesignal to 4.8.4

What did you expect to happen?

I expect the data on onesignal panel should be up to date regardless of the sdk version

OneSignal Android SDK version

4.8.4

Android version

13, 12, 11, 10, 9, 8, 7.1

Specific Android models

No response

Relevant log output

No response

Code of Conduct

jkasten2 commented 1 week ago

Thanks for reporting, the v4 SDK (Player Model) doesn't have knowledge of v5 (User Model) data structures. Some of these events the v4 SDK won't be able to handle the first time, as it will have to recreate data locally in the v4 format from OneSignal backend. Most likely after the first event the SDK will start working on future events, however this downgrade flow isn't a guaranteed either as it isn't something that is tested by the SDK maintainers.

The v4 SDK would have to know about the v5 format for everything to work without dropping any events. However this would be a big undertaking to account for and maintain backwards compatibility. A middle ground would be if the v4 SDK can always recover, however this would still be hard to maintain backwards compatibility long term.

We are focusing ensuring everything in v5 is working and there is no blockers to upgrading from v4 to v5, so a downgrade won't be necessary.