-
Notifications
You must be signed in to change notification settings - Fork 287
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] Web push opens the samsung internet browser instead the twa app #4777
Comments
Hi @jgw96
Thanks :) |
Thanks! So TWAs work a little different compared to PWAs installed from the browser. The reason the app is opening in-browser when you click on those notifications is because you subscribed to them in-browser. For the TWA, you would need to subscribe to the notifications in the installed app. On number 2, I found this discussion which might be valuable https://stackoverflow.com/questions/55531080/pwa-with-twa-how-to-force-chrome-instead-of-default-browser#:~:text=Look%20for%20browsers%20that%20support%20TWAs%2C%20if%20you,there%20are%20tradeoffs%20on%20the%20supported%20feature%20set. . No problem at all! |
@jgw96 Just to be clear, I subscribed to the notifications inside the TWA (the installed app; I thought you meant TWA when you said PWA). The push notifications code is in Javascript (I have used Notification.requestPermission() like in your guide), not Kotlin/Java. Do I have to implement native push notifications with Java/Kotlin code, or is it supposed to work with Notification.requestPermission() inside the TWA? |
Oh this is my bad, I misunderstood your reply. No you do not need to write any native code, this should just work. I am pretty busy this morning but I will try to reproduce this afternoon and get back to you. Thanks! |
I can share some additional information related to Samsung internet browser, most of users from my app are from Brazil which is very common to have samsung device (cheap/good cost benefit), and yes, since Samsung internet is the default browser for their devices it leads to a lot of different issues from their "TWA capabilities", few examples:
I'm still not testing notifications in production (currently wip), so unfortunately I can't share information related to this... but it should be no surprise this kind of behavior. At same point I did change android-browser-helper dependency to force Chrome as TWA browser for the app instead of the default (that is the recommendation from Andre), you can see my commit here: GoogleChrome/android-browser-helper@4dc656f . Changing the TWA browser picker does work, but if you have 3rd party login/oauth as I have, it breaks the user experience, because once they click to log in, it's going to open default browser which is Samsung and break the redirect w/ Chrome because of missing cookies and other checks, so I had to revert this change. @galharth I'd recommend to open an issue on https://forum.developer.samsung.com/ since the notification is showing the browser and not the app at the name spot, Chrome also had this bug and they fixed: GoogleChromeLabs/bubblewrap#647 (comment) |
@maiconcarraro @jgw96 The web push notifications open the native app when I force the TWA to use Chrome, but still, if there is no Chrome installed, the TWA opens the Samsung browser, and the web push does not open the native TWA. |
@galharth in this case it's definitely a bug on Samsung internet, you can report here https://forum.developer.samsung.com/c/samsung-internet/25 you mentioned something about the address bar at the top, if you have a signed apk (or directly from google store) + asset-link uploaded you shouldn't see anymore. (Reference for asset-link https://github.com/pwa-builder/CloudAPK/blob/master/Asset-links.md) |
@maiconcarraro huge thanks, I have nothing more to add here beyond I also tested this morning on my Pixel 8 with Chrome as the default, and it works as expected here, so I agree with @maiconcarraro that this seems like a bug in Samsung Internet. I am going to close this issue for now, thanks again! |
What happened?
When I click on a web push notification on an android phone it opens the Samsung internet browser instead of the installed twa app.
How do we reproduce the behavior?
This is my service-worker.js code:
I tried also this code for notificationclick event (but client.focus does nothing):
What do you expect to happen?
I expect the web push to open the TWA and not the Samsung internet browser.
What environment were you using?
I use Galaxy S10, android 12
Additional context
No response
The text was updated successfully, but these errors were encountered: