-
Notifications
You must be signed in to change notification settings - Fork 56
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
Support operating Bluetooth LE Audio and HFP profiles #226
base: master
Are you sure you want to change the base?
Conversation
- getAudioDeviceTypes: For checking if a BLE Headset is connected to Android system. - btIsLeAudioSupported: For checking if LE Audio is supported. - btLeAudioGetConnectedDevices: For checking all devices connected via LE Audio profile.
Update connect and disconnect methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't mix version bumping with feature additions.
I'm not sure whether this feature justifies bumping to 1.0 from 0.1 either.
So let's change the version code later.
description = | ||
"Connects to a paired or discovered device with HEADSET profile." | ||
+ "If a device has been discovered but not paired, this will pair it.") | ||
public void btHfpConnect(String deviceAddress) throws Throwable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem specific to LE audio?
Keep the code changes aligned with the PR descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR title and description to align the changes in this PR.
public BluetoothLeAudioSnippet() { | ||
mContext = InstrumentationRegistry.getInstrumentation().getContext(); | ||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); | ||
bluetoothAdapter.getProfileProxy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This getter call returns nothing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is for starting BluetoothProfile.ServiceListener
to get BluetoothLeAudio
profile when it is registered.
BluetoothDevice device = BluetoothAdapterSnippet.getKnownDeviceByAddress(deviceAddress); | ||
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_PAIRING_REQUEST); | ||
mContext.registerReceiver(new PairingBroadcastReceiver(mContext), filter); | ||
Utils.invokeByReflection(sLeAudioProfile, "connect", device); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need reflection here?
Would this work on user
builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the connect
and disconnect
methods are not public APIs, need to use reflection to call them at runtime.
I've tried user
builds on Pixel and Samsung phones, the APIs can work.
Thanks for reminding, I've reverted the changes. |
See also #183 and #208
This change is