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

Android transport type for GATT causing failures on some devices #231

Closed
keerl opened this issue Jul 9, 2021 · 2 comments
Closed

Android transport type for GATT causing failures on some devices #231

keerl opened this issue Jul 9, 2021 · 2 comments

Comments

@keerl
Copy link
Contributor

keerl commented Jul 9, 2021

I am encountering strange behaviors when using this plugin on Android across different devices. On most phones it works perfectly, and on some other phones I get failures right after (or during) connection (Samsung Galaxy s10e).

I have been able to track this down to the connectGatt() function and the problem has to do with selecting the transport param. Currently this option is hard coded to TRANSPORT_LE (https://github.com/nativescript-community/ble/blob/master/src/bluetooth.android.ts#L1721) where the other options are TRANSPORT_AUTO and TRANSPORT_BREDR (https://developer.android.com/reference/android/bluetooth/BluetoothDevice#connectGatt(android.content.Context,%20boolean,%20android.bluetooth.BluetoothGattCallback,%20int)).

I experimented with my Galaxy s10e and found that things only work when I set the transport to TRANSPORT_BREDR or TRANSPORT_AUTO.

Is there a reason that this is hard-coded for TRANSPORT_LE and not TRANSPORT_AUTO?

@farfromrefug
Copy link
Member

farfromrefug commented Jul 9, 2021

@keerl good catch! i think this has been like this since the beginning of time. Did not even know it existed!
Fixed in 3.0.28
EDIT: @keerl i still kept the default as TRANSPORT_LE. Seems like the best choice JuulLabs/kable#61

@keerl
Copy link
Contributor Author

keerl commented Jul 9, 2021

Perfect! Works great. Thanks for the quick patch @farfromrefug

@keerl keerl closed this as completed Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants