OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

[Bug]: 5.0.4 Android login creates unsubscription after 2 seconds unless permission is granted

Open johanlantz opened this issue 2 years ago • 4 comments

What happened?

Just calling login with the Android sdk creates an unsubscribe event after 2 seconds unless the notification permission is granted.

Screenshot 2023-12-01 at 17 00 48

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 avatar Dec 01 '23 16:12 johanlantz

@johanlantz thanks for reporting this! We will investigate.

jennantilla avatar Dec 06 '23 23:12 jennantilla

Same problem here, multiple unsubscribes on different devices, but in my case it is in the flutter sdk

PachecoLpG avatar Jan 15 '24 20:01 PachecoLpG

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

VitalyTimofeev avatar Jan 19 '24 18:01 VitalyTimofeev

We have made some changes that should have addressed this. Can you test again on 5.1.15?

jkasten2 avatar Jun 24 '24 19:06 jkasten2