Search code examples
androidbluetooth-lowenergyprogressive-web-apps

PWA + webbluetooth + BLE device


I have a app that connects to a smartwatch (BLE device) and reads data from it. The app is a android app coded in JAVA and I'm using a foreground service to keep the connection between the app and the watch "alive".

I would like to know if it is possible to do the same thing with a PWA/web app ? I managed to connect to the watch with the webluetooth API but how can I prevent the connection to close if the app isn't in the foreground ?

Thanks,


Solution

  • Current version of Web Bluetooth requires page to be in foreground. Depending on your BLE smartwatch device, you could retrieve previous data once page is brought back to the foreground though.