You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using btPairDevice(), the PairingBroadcastReceiver (automatic pairing confirmation) is only registered for the device from which the paring request is started. However, since the corresponding confirmation, for successful pairing must be confirmed on both devices, the PairingBroadcastReceiver must also be registered for the second device.
if (!(boolean) Utils.invokeByReflection(device, "createBond")) {
thrownewBluetoothAdapterSnippetException(
"Failed to initiate the pairing process to device: " + deviceAddress);
}
if (!Utils.waitUntil(() -> device.getBondState() == BluetoothDevice.BOND_BONDED, 120)) {
thrownewBluetoothAdapterSnippetException(
"Failed to pair with device " + deviceAddress + " after 2min.");
}
}
My solution for this problem was implementing a additional Rpc-function which is only used to register the broadcast receiver for any device as required.
public void btStartPairingBroadcastReceiver () {
mContext.registerReceiver(new PairingBroadcastReceiver(mContext), PairingBroadcastReceiver.filter);
}
The text was updated successfully, but these errors were encountered:
aglogger
changed the title
Bluetooth pairing failing when using two android devices
Bluetooth pairing fails when using two android devices
Jul 2, 2019
When using
btPairDevice()
, thePairingBroadcastReceiver
(automatic pairing confirmation) is only registered for the device from which the paring request is started. However, since the corresponding confirmation, for successful pairing must be confirmed on both devices, thePairingBroadcastReceiver
must also be registered for the second device.mobly-bundled-snippets/src/main/java/com/google/android/mobly/snippet/bundled/bluetooth/BluetoothAdapterSnippet.java
Lines 261 to 280 in b058548
My solution for this problem was implementing a additional Rpc-function which is only used to register the broadcast receiver for any device as required.
The text was updated successfully, but these errors were encountered: