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

Newbie needs help #151

Open
genee19 opened this issue Jun 22, 2023 · 4 comments
Open

Newbie needs help #151

genee19 opened this issue Jun 22, 2023 · 4 comments

Comments

@genee19
Copy link

genee19 commented Jun 22, 2023

Hi. I am trying to create a crossplatform app that operates with a specific Bluetooth LE device. This is my first time working with Bluetooth LE anywhere and I am having some trouble.

I have so far tried the very primitive example of scanning for devices and displaying them in a list, almost literally what you can get from the readme of quick_blue:

_report_line("Manual scan started");
    QuickBlue.startScan();
    QuickBlue.scanResultStream.listen((result) {
      _report_line("Manual scan result: $result");
    });
    Future.delayed(const Duration(seconds: 15), () {
      QuickBlue.stopScan();
      _report_line("Manual scan stopped");
    });

I've built it for macOS (my working laptop) and Android (target platform) and nowhere it is able to see any devices. It doesn't produce any errors or permission requests, just silently waits for timeout and stops scanning. I've tried to scan for a device that I know is working and is visible to that same phone (in Settings > Bluetooth), but it doesn't show up in the list of my app.

Do I have to request permissions myself? Maybe I miss some specific permissions in manifest? Please help me out.

@SahilSharma2710
Copy link

hey @genee19 , try this quick_blue_example , and try to debug app on real device
https://github.com/SahilSharma2710/quick_blue_example_2.0

@genee19
Copy link
Author

genee19 commented Jun 22, 2023

Hey, thanks for the answer. Worth mentioning that I test this on a real Android phone, a Galaxy A22, and I upload a built APK onto it via Bluetooth file transfer, so obviously BT is alive and kicking on both Mac and the phone.

I tried your example and it works like magic. I am trying to understand just which part I am missing.

@SahilSharma2710
Copy link

I am also new to this thing , I also have couple of questions , have you tried flutter_blue_plus package ? And do u have proper understanding of how things went in this BLE?

@genee19
Copy link
Author

genee19 commented Jun 22, 2023

Hey, I don't really think this depends on the used package that much: your app does see the devices around it, and mine doesn't, while both are using the same quick_blue. I've copied the <uses-permission> tags from your AndroidManifest.xml into mine, and now it does work at least on Android without any further code modifications. So it was about permissions there, and the documentation for quick_blue never mentions those.

Doing that same trick for macOS Info.plist didn't help though, my desktop app is still blind and wouldn't ask for BT permissions either (yours did, although the dialog stated it is Visual Studio Code that would like to use Bluetooth). So I am still perplexed as to what further changes I have to make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants