Skip to content
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

[Help]: On Web (Chrome), example is stuck at "Bluetooth Adapter is unknown" #1128

Closed
1 task done
panmari opened this issue Feb 21, 2025 · 6 comments
Closed
1 task done
Labels
help Questions, help, observations, or possible bugs

Comments

@panmari
Copy link

panmari commented Feb 21, 2025

Requirements

  • I've looked at the README 'Common Problems' section

Have you checked this problem on the example app?

Yes

FlutterBluePlus Version

1.35.3

Flutter Version

3.29.0

What OS?

All

OS Version

Windows 10, Chrome Stable

Bluetooth Module

Onit Bluetooth Adapter

What is your problem?

When starting the example app on WEB, I'm greeted with the "Bluetooth Adapter is unknown" screen, with no way to progress.

Logs

None
@panmari panmari added the help Questions, help, observations, or possible bugs label Feb 21, 2025
@chipweinberger
Copy link
Owner

chipweinberger commented Feb 21, 2025

please open PR, thanks

@panmari
Copy link
Author

panmari commented Feb 22, 2025

Am I understanding correctly then that the example app is not yet expected to work for web? If so, I'm happy to chip in. Do you have a few pointers on what would need to be done?

@ekuleshov
Copy link
Collaborator

I pushed a few fixes to main related to this.

@tnc1997 it seems like the getAdapterState() implementation wasn't updated when the "defaults" were added to the platform API. See my last commit there.

I also added some dummy values for the webOptionalServices parameter of the startScan() call in the example app (it is required for web and introduced in #1124). Also had to ignore some odd errors in the discoverServices() implementation for web.

With those changes I see some services and their chars when running example in a web browser. @tnc1997 @kubatatami could you please review this if you have some time.

The example app could also use some improvements. E.g. to allow to enter "withServices" and "webOptionalServices" parameters in the UI to use when scanning for devices.

@tnc1997
Copy link
Collaborator

tnc1997 commented Feb 22, 2025

@tnc1997 it seems like the getAdapterState() implementation wasn't updated when the "defaults" were added to the platform API

The reason that it defaulted to unknown on web is that it is not currently possible to accurately determine the adapter state on web as far as I am aware.

@ekuleshov
Copy link
Collaborator

@tnc1997 it seems like the getAdapterState() implementation wasn't updated when the "defaults" were added to the platform API

The reason that it defaulted to unknown on web is that it is not currently possible to accurately determine the adapter state on web as far as I am aware.

Right. We had similar issue with isSupported() call. So, changed implementation to use result of the isSupported() call to return "on" when true, and "unknown" otherwise.

@panmari panmari closed this as completed Feb 23, 2025
@panmari
Copy link
Author

panmari commented Feb 23, 2025

Thanks, that fixed the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help Questions, help, observations, or possible bugs
Projects
None yet
Development

No branches or pull requests

4 participants