Comments (15)
Hello,
Currently the library doesn't help with binding the devices and you have to bind it yourself.
from rxandroidble.
I don't want to bind the device. Just connecting, reading and writing.
from rxandroidble.
How does your device get the pin then? Standard Bluetooth implementation requires to pair the device in a PIN mode (binding process), which is currently unsupported. You can always bind the device yourself using BluetoothDevice object and continue with the library then. Although pull requests are kindly welcome!
from rxandroidble.
I added a notification to a characteristic and in the StatusBar a "binding notification" pops up. This is really bad, because I expected a PIN dialog popping up.
I'll check your advice with manual binding, but this way I had to know which characteristics are protected or is this a one time thing? How about PIN changes? Will I need to bind again?
from rxandroidble.
I am not an expert in binding the device just yet. The behaviour for binding may be different from vendor to vendor.
When binding devices - with the "Just Works" solution it's a one time thing. Other types you need to check out by yourself. If you will do that - please share the info here. The library may benefit from it.
Best Regards
from rxandroidble.
Any updates on this item? It would be nice have binding devices feature built into library.
from rxandroidble.
There is a chance that soon the connection will not be closed automatically when there is an encryption error. It will enable users to workaround this issue.
from rxandroidble.
And what about functionality, that will automatically propose to pair device using pin number if it's required by device during connection (when invoking establishConnection
)? For example how it's done from the Android's settings app. It's handled automatically there.
from rxandroidble.
I do not have much experience with devices that need bonding so I cannot really tell. I have read that usually Android shows a dialog / notification by itself.
If you will have a moment for investigation - feel free to look into it and report your findings or submit a PR :)
from rxandroidble.
If I have a chance I will :) Since it's demand feature for me right now.
Thanks for update.
from rxandroidble.
I figured out how we can bond device by prompting entering ping. Since RxBleDevice
has a reference to BluetoothDevice
we can simply call createBond()
and Android will do everything else for us.
Reference:
https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createBond()
from rxandroidble.
Unfortunately when testing I could not get stable results with .createBond()
. Once bonded — when canceled the bond — I could not make the device to bond again. Is that an issue for you?
from rxandroidble.
I can't reproduce this issue. Everything works good for me. Small note, that I've checking for already bounded devices, and don't bond it when it's already bonded.
from rxandroidble.
According to Apple guidelines(which most devices should aim to fulfill):
"as explained in Apple’s Bluetooth Accessory Design Guidelines. Instead, you should make sure to set the permissions as you want on your characteristics (see the usage of BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM() above), so that an error will be returned to the Central when it tries to do something that requires encryption. This error will then trigger most Central devices to automatically start bonding."
Basically if you attempt to read a characteristic that requires "authorization" the device should return a "ERROR_INSUFFICIENT_AUTHEN (0x41)" error code that will prompt the android system to automatically begin bonding the device. As for the pin requirement:
See
https://stackoverflow.com/questions/29204634/ios-bluetooth-ble-security-and-just-works-association-model
for a link to a table which explains the types of device configurations needed in order to have a pairing response needing "passkey entry" .
from rxandroidble.
As it is now possible to workaround this by either using BluetoothDevice RxBleDevice.getBluetoothDevice()
and calling BluetoothDevice.createBond()
or by retrying RxBleConnection.readCharacteristic()
/RxBleConnection.writeCharacteristic()
/RxBleConnection.setupNotification()
—closing.
There is already an issue for adding helpers.
from rxandroidble.
Related Issues (20)
- Building fork help HOT 6
- It is not possible to disconnect the Bluetooth while it is in the process of connecting. HOT 1
- BleGattCharacteristicException while readCharacteristic HOT 12
- scanResult.bleDevice.name not showing Ble updated name HOT 1
- BLUETOOTH_SCAN set usesPermissionFlags="neverForLocation",Is there a problem? HOT 2
- GenericFailure<CharacteristicValueUpdateError> HOT 11
- Send long bytes twice HOT 2
- Write request is not processed in the random order HOT 2
- Long Bytes Send HOT 8
- Creating a Fork HOT 2
- Set Preferred PHY / Read PHY HOT 2
- RxBleClient mulit connections HOT 4
- Is the library still maintained? HOT 3
- Android 14 breaking change HOT 15
- Google Pixel 5 loses bonding info after BT adapter cycle HOT 4
- Metode readcharacteristic not stream HOT 2
- Unable to readCharacteristic after writeCharacteristic HOT 5
- In the case of unsuccessful Bluetooth connection, actively disconnect without executing context. unregisterReceiver (receiver); At this point, there may be multiple Bluetooth broadcast registrarReceivers, which may crash on some Huawei phones due to a broadcast limit of approximately 1000. Suggest fixing this issue. HOT 2
- Can't scan after connect dispose/clear HOT 1
- Add `advertisingSid` property to `ScanResult` and `RxBleInternalScanResult` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxandroidble.