[Bug]: 5.0.4 Android login creates unsubscription after 2 seconds unless permission is granted
What happened?
Just calling login with the Android sdk creates an unsubscribe event after 2 seconds unless the notification permission is granted.
Steps to reproduce?
I used the Flutter example app and pressed login.
In Android it creates a Last Unsubscribed entry after two seconds unless I quickly grant the notification permission.
Same test using the flutter app on an iPhone does not create the Last Unsubscribed event.
What did you expect to happen?
Last Unsubscribed should not be created by just calling login.
OneSignal Android SDK version
5.0.4
Android version
13
Specific Android models
Pixel 7a with Android 14
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@johanlantz thanks for reporting this! We will investigate.
Same problem here, multiple unsubscribes on different devices, but in my case it is in the flutter sdk
The same problem with OneSignal 5.1.1 SDK version. We have following code to init sdk:
OneSignal.setConsentRequired(true);
OneSignal.setConsentGiven(true);
OneSignal.initWithContext(this, ONE_SIGNAL_APP_ID);
and following code to request permission after init
(btw we request permission not in application like in the integration guide but in onCreate of main activity):
fun requestPushPermission() { scope.launch { OneSignal.Notifications.requestPermission(true) } }
Here are our findings when testing different cases:
- if you first install the app being in Canada - your device is unsubscribed just in few seconds after. Delivery statistic shows your devices as "Unsubscribed". Restart of the app changes nothing.
- if you will connect to European VPN and restart the app - your device is subscribed. Pushes arriving fine
- if you will disconnect from VPN and restart the app to be in Canada again - your device still subscribed. Pushes arriving fine.
This behaviour appeared after migration from OneSignal 4.8.1 to 5.1.1. Android 14, target API 33
We have made some changes that should have addressed this. Can you test again on 5.1.15?
- Included in Flutter 5.2.1 if you are using that SDK.