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

[Android] IDevice.IsConnected doesnt update when Bluetooth radio is turned off. #822

Open
axa88 opened this issue Mar 1, 2024 · 4 comments

Comments

@axa88
Copy link

axa88 commented Mar 1, 2024

Upon switching an Android Bluetooth radio off, IDevice.State remains On and IBluetoothLE.StateChanged event should trigger.

Upon switching an Android Bluetooth radio off, report IDevice.IsConnected is not updated and DeviceConnected doesn't should trigger.

In contrast this works properly on WinUI

Understandably it is debatable what exactly should happen to an IDevice after the radio is switched off.
I understand on Android at least the GATT should be invalidated and arguable these objects be disposed of.
But apparently on WinUI these objects are still valid for connection.
But im reporting the issue as it is undefined and if possible uniform handling across platforms would be desirable.

Steps to reproduce

  1. switch radio Off

  2. observe IDevice.IsConnected remains On

  3. observe DeviceConnected event doesn't trigger.

Expected behavior

Upon switching an Android Bluetooth radio off, IDevice.State should propagate to Off and IBluetoothLE.StateChanged event should trigger.

Actual behavior

Upon switching an Android Bluetooth radio off, report IDevice.State remains On and IBluetoothLE.StateChanged event should trigger.

Crashlog

none

Configuration

Version of the Plugin:
v3.0.0

Platform:
Not working .NET8 Win10.0.19041.0
Working on .NET8 Android 12/13 target 34

Device: IBM X1 carbon 1, Samsung A11, Samsung A51

@smsissuechecker
Copy link

Hi @axa88,

I'm the friendly issue checker.
It seems like (37.50 %) you haven't used our issue template 😢 I think it is very frustrating for the repository owners, if you ignore them.

If you think it's fine to make an exception, just ignore this message.
But if you think it was a mistake to delete the template, please close the issue and create a new one.

Thanks!

@janusw
Copy link
Member

janusw commented Mar 1, 2024

I cannot confirm this with v3.1.0-beta.2 and .NET 8 (on a Samsung Galaxy S21+ with Android 14).

When Bluetooth is disabled, I even see two StateChanged events:

  • On -> TurningOff
  • TurningOff -> Off

@axa88
Copy link
Author

axa88 commented Mar 1, 2024

@janusw
Im sorry, i was tired, i meant to report IDevice.IsConnected doesn't update when the radio is turned off, though reported IDevice.State doesn't. Ill fix the report.

Though I was referring to my Q&A in in discussions where IBluetoothLE, including its State property is not working on WinUI
It reports IsOn/On and never updates when the radio is switched off.

@axa88 axa88 changed the title [Android] Bluetooth radio off is not reported [Android] IDevice.IsConnected doesnt update when Bluetooth radio is turned off. Mar 1, 2024
@axa88
Copy link
Author

axa88 commented Mar 18, 2024

@janusw

To simplify my concern here, perhaps you could explain what you believe should happen when the Radio is turned off.

Right now as I (eventually) reported, on Android there is no update about the lost connection. By that i mean Devices' IsConnected property doesn't change, the DeviceDisconnected event doesn't trigger.

While WinUI the IsConnected property does change and a DeviceConnected event does trigger.

I suggest this should be consistent across platforms.

Again sorry to confuse this with the State property and event of IBluetoothLE
If you justify the different behaviors, ill close the issue.

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

No branches or pull requests

3 participants