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

Oppo not show Bonding message #570

Open
LeugimDev opened this issue Jul 9, 2024 · 5 comments
Open

Oppo not show Bonding message #570

LeugimDev opened this issue Jul 9, 2024 · 5 comments
Labels

Comments

@LeugimDev
Copy link

Hello.

First of all, thank you for the library, I have been using it for a long time and it works better and better.

I have a problem with a device model, specifically an Oppo with Android 14, which, when the Android authorization message has to appear for the user to accept, does not show it and I don't know why.

I have tried other devices, Samsung, Xiaomi, Huawei, LG, Acer... and they all work but not this one.

Specifically, as a curiosity, I have tried different versions of the library and with 2.5.1, if the message appears, with the following ones and not with the last one, and I am interested in using the latest version because I have seen that in the others devices works much better for me.

Do you know any solution to this? Thank you

@LeugimDev LeugimDev changed the title Oppo not show paring message Oppo not show Bonding message Jul 9, 2024
@LeugimDev
Copy link
Author

To be more exact,

The OS is ColorOS 14.0
Name: OPPO Find X5
Model: CPH2307

@philips77
Copy link
Member

Hello,
The library just reports the broadcast event sent from the system. If the native bonding dialog doesn't show up, it means that something is wrong with the phone. I would suggest the basics: did you try to turn it off and on again? Or at least restart Bluetooth?

We don't have any Oppo devices. Could you please share the log from log(...) method in your BleManager implementation?

@LeugimDev
Copy link
Author

LeugimDev commented Aug 28, 2024

Hi, I tried that and several other options at the native level, finally I created a method right at the time of pairing where I do the following and it works in the part of

.connect(device)
   ?.before { device ->  
      if (device.bondState == BOND_NONE) { 
        feintBluetoothDeviceDiscovery(device) / 
      } else {
        // [...]
      }
      // [...]
   }
@SuppressLint("MissingPermission")
private fun feintBluetoothDeviceDiscovery(device: BluetoothDevice) {
   val btAdapter = BluetoothAdapter.getDefaultAdapter()
   GlobalScope.launch {
       delay(1000)
       btAdapter.cancelDiscovery()
       delay(100) 
       device.createBond() 
   }
}

@philips77
Copy link
Member

Are you are of the following method:

@IntRange(from = 0)
protected int getServiceDiscoveryDelay(final boolean bonded) {
return bonded ? 1600 : 300;
}

It delays service discovery after successful connection.
Do you request pairing from the device, of from Android?
If you have an iOS app, there's no API to request pairing from there. You have to request it from the device side, or try to read/write an attribute with permission encrypted or MITM.

The above method allows to delay service discovery until you'll get the pairing request from the device side.

@LeugimDev
Copy link
Author

Only use the library in Android.

In some tests I did what you told me, and it didn't work either, doing what I put above was the only thing that worked

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

No branches or pull requests

2 participants