Skip to content

Device side disconnection is not detected on android #615

Description

@patolax

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions