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]: Receives push notification only if tab is closed, can anyone please help me with this one ? #1193

Closed
aman-u-7span opened this issue Sep 13, 2024 · 2 comments

Comments

@aman-u-7span
Copy link

aman-u-7span commented Sep 13, 2024

What happened?

OneSignal is initialised successfully and there are no error or warnings in browser but this seems to be very weird behaviour as push notifications are received only if tab is completely closed.

What browsers are you seeing the problem on?

Firefox, Chrome (Chromium), Safari

What operating system are you running?

macOS monterey 12.7.1

Steps to reproduce?

- This is the cdn i'm using 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js'.
- importScripts("https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js") this is inside my service-worker file.

What did you expect to happen?

I expect to receive notifications even if tab is active or inactive.

Relevant log output

No response

@dongph9x
Copy link

dongph9x commented Sep 18, 2024

@aman-u-7span
Maybe sw of onesignal conflict with other sw, please move sw of onesignal without root folder.
Change scope and path of OneSignalSDKWorker.js
Ex: serviceWorkerParam: { scope: "/onesignal/push-notifications/" },
serviceWorkerPath: "onesignal/push-notifications/OneSignalSDKWorker.js",

@aman-u-7span
Copy link
Author

@dongph9x I didn't have any other service worker but moving service worker to another folder worked. Thanks mate really appreciate it.

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