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

Device side disconnection is not detected on android #615

Open
patolax opened this issue Oct 18, 2021 · 0 comments
Open

Device side disconnection is not detected on android #615

patolax opened this issue Oct 18, 2021 · 0 comments

Comments

@patolax
Copy link

patolax commented Oct 18, 2021

I want to detect the device shutdown when the app is already connected. At the moment I dont see an approch to do this on android.


I listen to observeConnectionState, but this stream is not emiting anything on device disconnect. 
 _bleDeviceConnectionStateSubscription = peripheral
        .observeConnectionState(
            emitCurrentValue: false, completeOnDisconnect: true)
        .listen((connectionState) {
      print(
          "Peripheral ${device.peripheral.identifier} connection state is $connectionState");
      _bleDeviceConnectionStateSubject.add(connectionState);
    });

I also tired calling isConnected method, however even when device is shutdown it returns true.

var connection = await _bleDevice.peripheral.isConnected();

Is there a way to monitor device side disconnection and show a message to the user.

@patolax patolax changed the title Device disconnection is not detected Device disconnection is not detected on android Oct 18, 2021
@patolax patolax changed the title Device disconnection is not detected on android Device side disconnection is not detected on android Oct 18, 2021
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

1 participant