You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you may know, background geolocation doesn't work on the web.
The problem is that the Web Geolocation API immediately stops working as soon as the page goes from foreground to background (the
tab is closed / not focused or browser / installed PWA minimized or closed).
Moreover, Geolocation API isn't available in Service Workers.
Without background geolocation, a whole bunch of apps simply can't be implemented as PWAs! :(
Is it possible to implement background geolocation natively and use postMessage (https://developer.chrome.com/docs/android/post-message-twa)
to pass coordinates data from Android native code to JavaScript (the page code or service worker)?
Ideally, this should be a plug-in (module/extension) for Bubblewrap (https://github.com/GoogleChromeLabs/bubblewrap) that can be enabled/disabled in options like other features in Bubblewrap.
BTW, Bubblewrap is written in Java, not Kotlin.
Maybe it's possible to combine them into one demo without rewriting them into one language? Although all 3 demos are small.
The text was updated successfully, but these errors were encountered:
And the main question: is it possible at all to receive "message" events generated with postMessage in TWA (and send messages back to native code), in Service Worker instead of Window (if the page is closed)?
As you may know, background geolocation doesn't work on the web.
The problem is that the Web Geolocation API immediately stops working as soon as the page goes from foreground to background (the
tab is closed / not focused or browser / installed PWA minimized or closed).
Moreover, Geolocation API isn't available in Service Workers.
Without background geolocation, a whole bunch of apps simply can't be implemented as PWAs! :(
Is it possible to implement background geolocation natively and use
postMessage
(https://developer.chrome.com/docs/android/post-message-twa)to pass coordinates data from Android native code to JavaScript (the page code or service worker)?
I've tried to combine the https://github.com/GoogleChrome/android-browser-helper/tree/main/demos/twa-post-message demo with official demos from Android docs:
but, unfortunately, so far without success. :(
I'm not an Android developer. The problem is that
postMessage
demo is written in Java, but official demos from Android docs are written in Kotlin.What about creating a demo for Background Geolocation / Geofencing +
postMessage
?The result demo could be published in the https://github.com/GoogleChrome/android-browser-helper/tree/main/demos/
as a very useful sample of "hybrid" TWA app that would help the whole community a lot!
Ideally, this should be a plug-in (module/extension) for Bubblewrap (https://github.com/GoogleChromeLabs/bubblewrap) that can be enabled/disabled in options like other features in Bubblewrap.
BTW, Bubblewrap is written in Java, not Kotlin.
Maybe it's possible to combine them into one demo without rewriting them into one language? Although all 3 demos are small.
The text was updated successfully, but these errors were encountered: