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
604 stars 368 forks source link

[Bug]: OptIn() is not working and not updating OneSignal Dashboard #2104

Open simranthakkar1996 opened 4 months ago

simranthakkar1996 commented 4 months ago

What happened?

Using 5.1.13 release.

Calling OneSignal.getUser().getPushSubscription().optOut() does opt the user out as reflected on the dashboard. However, immediately calling OneSignal.getUser().getPushSubscription().optIn() doesn't change the opt-in status, user is still opt-out on the dashboard and cannot receive notifications.

I tried referring 2 bugs that were reported https://github.com/OneSignal/OneSignal-Android-SDK/issues/1837 https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/729

And they mentioned that it was solved in newer release but its still not working Also I did put debug points in below code and it is going into the respective optIn() and optOut() And optOut() works as expected as well it changes status on Dashboard But when we turn it on from settings it goes into OptIn() condition but its not doing anything on OneSignal side

if (isEnabled) {
            OneSignal.getUser().getPushSubscription().optIn();
        } else {
            OneSignal.getUser().getPushSubscription().optOut();
        }

Also I am using requestPermission to prompt the dialog for notification permission

Steps to reproduce?

Mentioned above

What did you expect to happen?

User should change the status subscribed after calling optIn in OneSignal dashboard and should be able to send the notification successfully

OneSignal Android SDK version

5.1.13

Android version

13

Specific Android models

No response

Relevant log output

No response

Code of Conduct

jennantilla commented 3 months ago

Hello @simranthakkar1996 thank you for reaching out! Would you be able to send over a log of from the device reproducing this behavior so we can see if there are any clues there?

Thanks!