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

Implement createBond/getBondState on Android (#605) #843

Merged
merged 3 commits into from
Feb 18, 2023

Conversation

peitschie
Copy link
Collaborator

Tested with Android 10 & Android 11... so far so good 😃

@Doomkyn
Copy link

Doomkyn commented May 3, 2021

Dear @peitschie ,
I'm working on Android with your implementation of createBond, anyway, when I try to bond my BLE device with the phone, while in the NRF Connect app it asks me for Bonding requesting the PIN, using the plugin it only tries to Bond but DOES NOT request for a PIN and therefore, the bonding fails.
Am I missing something?
Thanks for the response.

@peitschie
Copy link
Collaborator Author

@Doomkyn I believe you might want to look at the setPin workflow here. I'm not sure if that fits your requirements exactly though, apologies: https://github.com/don/cordova-plugin-ble-central#setpin

@Doomkyn
Copy link

Doomkyn commented May 3, 2021

Thanks for the quick response, don't wanna bother just trying to understand how I should work with these functions.
At the moment my BLE device has encrypted characteristics that need authentication.
The first thing I do is connecting to the device then setting the pin with setPin.
After that I tried different flows: reading the encrypted characteristic fails with status 137 (it doesn't ask me for pairing), createBond fails with message "none" (still not asking for PIN)...
When I try the NRF connect app, I can connect and I see the encrypted characteristics, when I try to read them, Android prompts me for Pairing with a PIN. Typing the correct pin bond the device and let me read the encrypted characteristic.
If I bond with NRF connect app, then I'm able to read my characteristics through the plugin.

@peitschie
Copy link
Collaborator Author

Looking at the PR that added the setPin method (https://github.com/don/cordova-plugin-ble-central/pull/718/files) looks like it might be meant to be called before connection?

The best I could suggest is checking whether that broadcast intent there is fired in your case. I haven't had to do anything with PIN-based pairing like this, sorry... I can't really point to anything specific that might help you.

@Doomkyn
Copy link

Doomkyn commented May 5, 2021

Thanks for the reply, I will do a bunch of tests :)

@peitschie peitschie force-pushed the bonding branch 3 times, most recently from a8e7e53 to 9a17f7a Compare February 16, 2023 07:26
@peitschie peitschie added this to the next milestone Feb 16, 2023
peitschie and others added 3 commits February 18, 2023 20:30
This was added for Android 6, but it's unclear how this might affect
device scanning. Docos suggest this only impacts connecting, so should be
safe to ignore.
@peitschie peitschie merged commit 58e212a into don:master Feb 18, 2023
@peitschie peitschie deleted the bonding branch February 19, 2023 22:54
@peitschie peitschie modified the milestones: next, 1.6.3 Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants