Search code examples
iosbluetoothbluetooth-lowenergyprogressive-web-appsweb-bluetooth

How to pair with a Bluetooth device from an iOS web application?


When I look at https://caniuse.com/mdn-api_bluetooth it indicates that neither Safari not iOS Safari supports Web Bluetooth, and due to Apple policy all iOS browsers basically Safaris as well, so this means none of the browsers could come to rescue even if they'd normally open to Web Bluetooth.

However certain news outlets reported lately that bluetooth game controllers could be paired on iOS for game streaming webapps: https://www.extremetech.com/gaming/317578-nvidia-google-to-support-cloud-gaming-on-iphone-via-web-apps

You can pair an Xbox, PS4, or mobile Bluetooth controller with the device. The web app also has touch controls, but they won’t work in all games.

How is that possible technologically? I have a native mobile application which communicates with Bluetooth Low Energy devices and I'd move it to web if Apple platform could be covered as well. Articles report that Apple explicitly avoids Web Bluetooth citing privacy reasons: https://www.zdnet.com/article/apple-declined-to-implement-16-web-apis-in-safari-due-to-privacy-concerns/


Solution

  • Bluefy and WebBLE provide implementations of the Web Bluetooth API on top of WKWebView.