Android Question Push messages: web-browser's and Android app's ones

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Web-browsers can be subscribed to the push messages from a web-site.
Firebase has VAPID keys for such communications: Web Push certificates (https://developers.google.com/web/u...s#introducing_vapid_for_server_identification).

And user must allow the notifications to the web-browser, to see the popup alerts from web-sites.

Subscription looks like
1) endpoint URL, for FCM like https://fcm.googleapis.com/fcm/send/fVsd.....
2) Public key (P-256 ECDH) for push-message encoding
3) The secret key for push-message encoding


Are these different push-messages ? Android push-messages and these Web Push.

The case is to make the web-site that can send such pushes to the web-browsers, I have made such web-site. And mobile web-browser can receive such Web Push-messages.
But, as we all know, Android kills apps and the browsers also after some time, even all is allowed.

So, how to arrange the push waking up the WebView Android app, opening such web-site ? Maybe anyone did and knows?
 

DonManfred

Expert
Licensed User
Longtime User
Google for "how does push notification works for a website"

So, how to arrange the push waking up the WebView Android app, opening such web-site ?
I don´t think that these notifications work with android. Means i dont think you can wake up the device with such a notification.
For a android device to wake up you need to run a service in android to listen 24/7 for these notifications to react on them..

Also note that these notifications probably don´t work with a Webview but only with real browsers.
I guess you must find your own way to wake up the device. for ex. using firebase notifications.
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
ChatGPT answered me that one need to run Javascript in the browser to create a token and to react on these notifications. As i wrote it works in desktopbrowsers...
Means the browser already need to run. There is no device-waking involved here at all.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
As i could understand - it's different push kinds, so both should be subscribed, if needed.
Web Pushes subscription for real browsers that support them (not WebView), and Android push user's device token subscription, for the app.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
i dont think you can wake up the device with such a notification.
No, they really works (web pushes), wake the phone up, the browser icon show a badge, makes the notification even with the switched off screen.
But after 15-20 mins Android puts the web-browser to sleep anyway (power control was set up for sure) and ... no pushes more until manual screen on.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
so both should be subscribed,
yes. ChatGPT told me that the JS creates a token which needs to send to Firebase and stored on your server.
the js is the receiving part for these notifications.
But i don´t know how that works at all. I hate Javascript and do not use it. I can´t help here.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
I hate Javascript
YES, i hate it too !

But latest month i have set the strange task to myself - to vibecode the web-site (like Asana), task messenger.
And i ... could make it knowing nothing about JS, 10% about PHP. AI rules.

But it's the messenger without real push notification for talking... I thought the Android push may help... but seems, just extra complexity.
 
Upvote 0
Top