Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 822
Joe Morano Avatar asked Jan 04 '20 21:01

Joe Morano


People also ask

How does Siri connect to Bluetooth devices?

Now, when you press and hold that Home button on your iPhone or iPad, you'll see a glowing blue speaker icon just to the right of Siri's typical microphone icon. Tap there, and then choose the Bluetooth device to set it as the input device.

Why is my iPhone 12 not picking up Bluetooth devices?

Make sure that your Bluetooth accessory and iOS or iPadOS device are close to each other. Turn your Bluetooth accessory off and back on again. Make sure that your Bluetooth accessory is on and fully charged or connected to power. If your accessory uses batteries, see if they need to be replaced.

Can a PWA use Bluetooth?

Yes, you can access in Geo Location(for GPS) and Bluetooth in PWA.

Does iOS support Web Bluetooth?

Users can create web solutions that will work on all iOS devices. To implement the capabilities of the web Bluetooth browser, you need to turn on Bluetooth on your smartphone and device, open the web API page adapted to the device, make a connection and you can start creating individual web solutions.


2 Answers

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.

like image 127
Sven Avatar answered Nov 15 '22 08:11

Sven


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

like image 20
abraham Avatar answered Nov 15 '22 06:11

abraham