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

The application is responding to devices that are not mine. #212

Open
berrmount opened this issue Jul 3, 2024 · 4 comments
Open

The application is responding to devices that are not mine. #212

berrmount opened this issue Jul 3, 2024 · 4 comments

Comments

@berrmount
Copy link

berrmount commented Jul 3, 2024

Device: Galaxy S22+ with Airpods 2
The application may not be utilizing the device address or is solely dependent on the device name, "AirPods".
I am in a location with a numerous AirPods nearby.
It displays other devices that are not owned by the user as "mine", despite the "Show all devices" feature being disabled.
Consequently, the auto-play and auto-pause functions are triggered and plays/stops music even when no devices are connected.

@d4rken
Copy link
Member

d4rken commented Jul 4, 2024

It's not great, but that's the best we can do. CAPod uses a heuristic based on signal strength to determine which are "yours". The Bluetooth address send by the AirPods is randomized and can't be used to determine which are yours. The name is also not part of the BLE broadcast that contains the information like battery status etc.

Just doing the best we can with what is available. Direct access like Apple does it on iPhones, is not possible on Android's Bluetooth stack as far as I know.

@berrmount
Copy link
Author

I understand, but there are 2 problems.

  1. My AirPods respond to other AirPods that I do not own when connected to my AirPods.
  2. My AirPods respond to other AirPods even when I am NOT connected to any Bluetooth devices.

Additionally, I use Tasker to play music when connected to my AirPods, and it has worked fine so far using the MAC address to identify the device. Could this method be a potential solution, or I wasn't using this method long enough to encounter the problem you've mentioned?

@d4rken
Copy link
Member

d4rken commented Jul 5, 2024

Could this method be a potential solution

No

There are two ways AirPods offer information:

  1. Direct Bluetooth connection, this is the one you pair in system settings, you get audio this way. We know which one is yours because it's directly talking to us.
  2. Indirect Bluetooth Broadcasts, no need to pair for this. We don't know which one is yours because it's a random message with a random address that changes every few minutes. We only know how close and how long it was close to us based on signal strength.

The following information like

  • Airpod Battery Levels
  • Case Status
  • In-Ear Status
  • Charging Status

is not available through method 1 because Android does not support it.

My AirPods respond to other AirPods that I do not own when connected to my AirPods.

Doesn't have a good solution, I already did everything I could think off to reduce false positives

My AirPods respond to other AirPods even when I am NOT connected to any Bluetooth devices.

Here we could maybe change the code so it does not execute any reactions if there are no AirPods connected to your phone 🤔

@d4rken
Copy link
Member

d4rken commented Jul 5, 2024

Here we could maybe change the code so it does not execute any reactions if there are no AirPods connected to your phone 🤔

This should already be the case.

We get only continue if there is a headset device connected:

.flatMapLatest { if (it) bluetoothManager.connectedDevices() else emptyFlow() }
.flatMapLatest {
if (it.isEmpty()) {
log(TAG) { "No known devices connected." }
emptyFlow()
} else {
log(TAG) { "Known devices connected: $it" }
podMonitor.mainDevice
}
}

fun connectedDevices(
featureFilter: Set<ParcelUuid> = ContinuityProtocol.BLE_FEATURE_UUIDS
): Flow<List<BluetoothDevice2>> = isBluetoothEnabled

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

2 participants