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

Windows Release build does not find devices. #93

Open
johncharris opened this issue Oct 21, 2024 · 5 comments
Open

Windows Release build does not find devices. #93

johncharris opened this issue Oct 21, 2024 · 5 comments

Comments

@johncharris
Copy link

I have a simple app that does a BLE scan and connects to a device and shows the value of an attribute. This works in debug mode, but when in Release no devices are found. This is before any packaging. I'm trying to run it straight out of the release folder after it was built.

Any ideas?

@Wicz3k
Copy link

Wicz3k commented Oct 22, 2024

Did you try flutter clean?
Problem is only on windows?
Did you try example app?
Try share some code.

@johncharris
Copy link
Author

I ran the example code, and it works fine so the problem is on my side. I'll update my code to be more like the example and post back if I find the issue.

@johncharris
Copy link
Author

I've had no luck figuring this out. I published my code at https://github.com/johncharris/ble_temperture.

@rohitsangwan01
Copy link
Contributor

rohitsangwan01 commented Oct 31, 2024

@johncharris maybe add a try/catch block when calling start scan here in your code, and log that with your addMessage to cross check if startScan is failing somehow in release build

try {
     await UniversalBle.startScan();
catch(e) {
    addMessage("ScanFailed: $e");
}

Or try to compare your windows/CMakeLists.txt with this plugin's example/window/CMakeLists.txt and see if you see any major change there, and try to modify accordingly

or Try to install Nuget

Please try these steps one by one

@Sravdar
Copy link

Sravdar commented Nov 20, 2024

I had similar problem today. When app is first launched it said bluetooth is not enabled. When closed the bluetooth by hand and re-opened it started scaning.

I think on windows release builds when you open the executable onAvailabilityChange callback doesn't get called unlike the behaviour in debug mode. On initstate calling UniversalBle.getBluetoothAvailabilityState(); fixed this problem.

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

4 participants