Skip to content

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

Open
@jpdelmundo

Description

@jpdelmundo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions