'Is there a workaround for iOS PWAs to talk to bluetooth devices?

So iOS doesn't support native access to bluetooth by progressive web apps. Is there any kind of workaround for this? Youtube.com can definitely play sound from a bluetooth speaker, so it's possible on some level. Is it still possible for Safari websites to arbitrarily talk to bluetooth devices somehow?



Solution 1:[1]

What you ask for is access to the Web Bluetooth API from Safari on iOS. For that to happen, WebKit, the browser engine that power Safari, has to implement that feature. The current official status is "Not Considering".

In other words: you won't find support for Web Bluetooth API in Safari on iOS tomorrow or anytime soon.

Possible workarounds depend a lot on your specific situation. Do you have control over the Bluetooth device? Does the device have other means of communicating? Is it acceptable to the users of your web app to download an alternative browser? Here are some ideas from the top of my head.

Build your own browser with support for Web Bluetooth API

When developing native applications for iOS and iPadOS, you have access to Bluetooth. You could build a custom web browser using WKWebView and add support for Web Bluetooth API yourself.

Download a web browser with Web Bluetooth support

I've used WebBLE and Cider Connect with success.

Creative solutions

There could be other creative solutions to your problem if you have control over the Bluetooth device. As you wrote, it is possible to stream audio from a website to a Bluetooth speaker (and the other way around). If you are in control of the Bluetooth device, nothing is stopping you from sending data over audio (building an acoustic modem like in the good old days).

Maybe the Bluetooth device has other connections or sensors. If it has a camera, the progressive web app could send data that way.

It's a little hard to come up with ideas, though, without knowing more about what it is you're trying to accomplish.

Solution 2:[2]

Consider a Web BLE browser such as Bluefy - it effectively behaves as a conventional browser but with Web Bluetooth support.

Solution 3:[3]

Safari/iOS might someday support the Web Bluetooth API but currently they don't.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sven
Solution 2 Steak Sauce
Solution 3 abraham