-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support bluetooth-le for Electron platform #505
Comments
I have managed to make it work by hacking but capacitor electron is so messy that I don't know how it could be integrated properly. |
Nice that you have managed to make it work. So you added code to handle the Unfortunately I don't have any experience with capacitor electron. |
That is correct. select-bluetooth-device needs to be implemented. I find capacitor Electron 'complicated'. I really don't know how a capacitor plugin could properly implement some Electron code especially in this case which you need to do some back and forth between Electron, plugin and main app... What I have done is to hack my own project. Anyway, this issue is labeled "enhancement", not "bug". |
another option if you want full support is to use a native module like https://github.com/abandonware/noble instead. If it's still being maintained, then last i heard it could use the native bluetooth on the system, rather than the more limited webbluetooth api. |
Thank you for the good suggestion. The integration still remains complicated because of the overall architecture has so many IP blocks (Ionic, Capacitor, Electron, then noble). I'm fine with my ugly hack for the moment. I think that this issue is a kind of long-term enhancement. |
Hi @gregoiregentil, any chance that you could share your solution? I'm having the same issue here, thanks in advance! 🙏 |
I don't know exactly how I have managed to make this work. My code is too messy to share but I see those two pieces of code that are definitely necessary:
and also:
|
@gregoiregentil sure that helps! Thanks ❤️ |
Capacitor community bluetooth-le supports web platform (if web bluetooth is supported by the browser).
If the plugin is run from a capacitor Electron app, the following error message appears:
"scanForBluetoothDevices Error Error: Web Bluetooth API not available in this browser."
It would be great to support Electron apps.
I do think that the web code "src/web.ts" could be re-used as Electron is leveraging chromium browser which supports web bluetooth. More info is available at the top of this page: https://www.electronjs.org/docs/latest/tutorial/devices
The text was updated successfully, but these errors were encountered: