web-push-libs / webpush-java

Web Push library for Java
MIT License
315 stars 113 forks source link

not able to make push notifications pop up on screen of android phone #174

Closed manuel-ch closed 3 years ago

manuel-ch commented 3 years ago

see my post on SO: https://stackoverflow.com/questions/67862991/progressive-web-app-pwa-not-able-to-make-push-notifications-pop-up-on-screen-o

is this a known limitation of web push compared to native apps?

martijndwars commented 3 years ago

From your post on SO:

After some research, i found out that native android apps need to add "notification channels" (feature added with android oreo) to be able to set the app's notification setting to "sound and pop-up" (pop up may also be called heads-up) instead of only "sound". For PWA, i can not find any information about such options.

In the android notification settings of my (installed) PWA, there is one category called "General", Setting is sound only, pop-up / heads-up is not activated. When i activate it, the notifications pops up as expected.

I think you answered your question yourself already. Android apps need to be granted a permission to show a popup, and unless you grant this permission, you won't see a popup. This is a limitation of the Android ecosystem, not of the Web Push protocol or this library.

manuel-ch commented 2 years ago

Hi Martin

Thanks for your answer, could you add it to SO post https://stackoverflow.com/questions/67862991/progressive-web-app-pwa-not-able-to-make-push-notifications-pop-up-on-screen-o?

There are some other posts piling up on SO so your answer may be welcome!

Thanks!

Manuel

Von: Martijn Dwars @.> Gesendet: Freitag, 11. Juni 2021 12:57 An: web-push-libs/webpush-java @.> Cc: manuel-ch @.>; Author @.> Betreff: Re: [web-push-libs/webpush-java] not able to make push notifications pop up on screen of android phone (#174)

From your post on SO:

After some research, i found out that native android apps need to add "notification channels" (feature added with android oreo) to be able to set the app's notification setting to "sound and pop-up" (pop up may also be called heads-up) instead of only "sound". For PWA, i can not find any information about such options.

In the android notification settings of my (installed) PWA, there is one category called "General", Setting is sound only, pop-up / heads-up is not activated. When i activate it, the notifications pops up as expected.

I think you answered your question yourself already. Android apps need to be granted a permission to show a popup, and unless you grant this permission, you won't see a popup. This is a limitation of the Android ecosystem, not of the Web Push protocol or this library.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/web-push-libs/webpush-java/issues/174#issuecomment-859498357 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AECNTQYC234EGNITM3E6MYTTSHTWZANCNFSM46QEFDXA . https://github.com/notifications/beacon/AECNTQ42D52CEPPNXCHHCKDTSHTWZA5CNFSM46QEFDXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGM5OO5I.gif

martijndwars commented 2 years ago

I'll add a comment after my vacation. Feel free to copy my answer to StackOverflow if you have the opportunity.