PhilipsHue / flutter_reactive_ble

Flutter library that handles BLE operations for multiple devices.
https://developers.meethue.com/
Other
662 stars 326 forks source link

"Scanning parameters are not set" on Hot Restart #114

Closed xvrh closed 3 years ago

xvrh commented 3 years ago

Describe the bug On Android, I consistently have a failure on the first scanForDevices after a Hot Restart.

To Reproduce Steps to reproduce the behavior:

This program have a single button to start a bluetooth scan

import 'package:flutter/material.dart';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';

void main() => runApp(MaterialApp(
      home: Scaffold(
        body: BluetoothApp(),
      ),
    ));

final _client = FlutterReactiveBle();

class BluetoothApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: RaisedButton(
        onPressed: () {
          _client.scanForDevices(
              withServices: [], scanMode: ScanMode.lowLatency).listen((device) {
            print('Found ${device.name}');
          }, onError: (e) {
            print('Scan error $e');
          }, cancelOnError: true);
        },
        child: Text('Start scan'),
      ),
    );
  }
}

Expected behavior It would improve developer experience if the library was more resilient to this case.

Smartphone / tablet I can consistently reproduce on this 3 devices: Motorola G5 (Android 8.1.0), Huawei P9 lite (Android 7.0), Nokia android One (Android 9)

Package version: 2.5.0

Peripheral device NA

Additional context This error message has already been reported here: https://github.com/PhilipsHue/flutter_reactive_ble/issues/87 but I don't known if this is the same issue.

remonh87 commented 3 years ago

@xvrh good catch I fixed the issue and it should be available in release 2.5.2

xvrh commented 3 years ago

Excellent. Thanks 👍

ened commented 2 years ago

This may have regressed in the latest versions, @remonh87

GaelleJoubert commented 2 years ago

Yes, I have the error as well (using V5.0.2 of this plugging).

CPMoviePHil commented 2 years ago

face the same issue here flutter_reactive_ble: ^5.0.2 android 12 pixel 4(real device)

sdale511 commented 7 months ago

same issue here with android 12 pixel 3a flutter_reactive_ble: ^5.0.3

HugoHeneault commented 7 months ago

Same same :')