Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: OneSignal.registerForPushNotifications does not re-subscribe the player ID (subscription status is still "Not Subscribed") #1152

Open
jpdelmundo opened this issue Jan 8, 2024 · 3 comments

Comments

@jpdelmundo
Copy link

jpdelmundo commented Jan 8, 2024

What happened?

Setup works initially the first time the user accepts/allows the browser notification setting. However, when I manually disable the browser notification and decided to re-enable it again after some time (a few minutes), and calling OneSignal.registerForPushNotifications() does not re-subscribe the player ID.

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

Windows 11 Pro 23H2 22631.2861

Steps to reproduce?

1. Setup
var OneSignal = OneSignal || [];
          OneSignal.push(["init", {
            appId: '<app id here>',
            autoRegister: false,
            notifyButton: {
              enable: false /* Set to false to hide */
            },
            ,welcomeNotification: {
                "title": "You're almost done!",
                "message": "Please click here to log in to your account and configure your notifications.",
                "url": "https://mydomain.com/welcome-message"
            }
                      }]);


2. Make sure browser notification setting is allowed, then visit the page with the setup above.
3. Note the player/subscription ID from console: OneSignal.getUserId().then(r=>console.log(r))
4. Verify the player ID Subscription Status in dashboard.onesignal.com App > Audience > Subscription (should show check mark)
5. Disable / disallow browser notification setting. Reload.
6. Wait some time.
7. Verify the player ID Subscription Status in dashboard.onesignal.com App > Audience > Subscription (should show Not Subscribed)
8. Enable / Allow browser notification setting. Reload. Wait some time.
9. Verify the player ID Subscription Status in dashboard.onesignal.com App > Audience > Subscription (still showing Not Subscribed)
10. In browser console run: OneSignal.registerForPushNotifications(). Wait some time.
11. Verify the player ID Subscription Status in dashboard.onesignal.com App > Audience > Subscription (still showing Not Subscribed)

What did you expect to happen?

I expected the player ID status to be subscribed (check mark under "Subscription Status")

Relevant log output

No response

@jpdelmundo
Copy link
Author

I also called OneSignal.setSubscription(true) manually in the web console after OneSignal.registerForPushNotifications(), and still the status is "Not Subscribed".

@jkasten2
Copy link
Member

@jpdelmundo Thanks for reporting this issue. I confirmed this happens in v15 of the OneSignal SDK. I also tested in v16 and can confirm this is no longer an issue.

Can you update to v16 by following following the details in the release notes?
https://github.com/OneSignal/OneSignal-Website-SDK/releases/tag/160000

@jpdelmundo
Copy link
Author

@jkasten2 Thank you for your response and confirming this issue is a bug.

I confirmed this happens in v15 of the OneSignal SDK

If this is a confirmed bug, when will this be fixed on v15?

I also tested in v16 and can confirm this is no longer an issue.

We are not yet planning on upgrading to v16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants