Bluetooth library refuses to connect to anything

42 views
Skip to first unread message

Gareth Murfin

unread,
Aug 28, 2019, 4:57:22 PM8/28/19
to CodenameOne Discussions
Has anyone ever had the call back to connect() called when connecting to a bluetooth device? Doesnt happen here. Any working examples anywhere that connect?

Kandy Bitxenio

unread,
Aug 28, 2019, 6:16:48 PM8/28/19
to CodenameOne Discussions
Hi Garet

import this project sample, this works, connect, read, etc fine.


Best Regards

Shai Almog

unread,
Aug 28, 2019, 10:39:16 PM8/28/19
to CodenameOne Discussions
I'm guessing you're trying to connect to a bluetooth device instead of a bluetooth-LE device. Notice the LE which is a different standard. Generally bluetooth in all its forms is painful.

Gareth Murfin

unread,
Aug 29, 2019, 8:44:04 AM8/29/19
to CodenameOne Discussions
thanks Shai, this is a bluetooth LE device, is there something specific I need to do to connect? rather than just calling connect()  ?

On Thu, 29 Aug 2019 at 03:39, Shai Almog <shai....@gmail.com> wrote:
I'm guessing you're trying to connect to a bluetooth device instead of a bluetooth-LE device. Notice the LE which is a different standard. Generally bluetooth in all its forms is painful.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/5hDDwbOFxyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/fac02c23-34aa-4d9c-b26d-fbbf8de5ca85%40googlegroups.com.


--
Gareth Murfin
(Android Freelancer - www.garethmurfin.co.uk)

Gareth Murfin

unread,
Aug 29, 2019, 9:51:21 AM8/29/19
to CodenameOne Discussions
Painful indeed, it simply wont connect no matter what I do (im presuming the call back should be called if it connects). So I guess I will have to cancel this contract unfortunately. Not sure if its due to the device im connecting to which is a rasberry pi but it is meant to be bluetooth LE. Or maybe my phone isnt supported (samsung s7, android 8)..


On Thursday, August 29, 2019 at 1:44:04 PM UTC+1, Gareth Murfin wrote:
thanks Shai, this is a bluetooth LE device, is there something specific I need to do to connect? rather than just calling connect()  ?

On Thu, 29 Aug 2019 at 03:39, Shai Almog <shai....@gmail.com> wrote:
I'm guessing you're trying to connect to a bluetooth device instead of a bluetooth-LE device. Notice the LE which is a different standard. Generally bluetooth in all its forms is painful.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/5hDDwbOFxyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discussions+unsub...@googlegroups.com.

Gareth Murfin

unread,
Aug 29, 2019, 10:21:23 AM8/29/19
to CodenameOne Discussions
Seems like the lib should pass BluetoothDevice.TRANSPORT_LE  here ?
BluetoothGatt bluetoothGatt = device.connectGatt(cordova.getActivity().getApplicationContext(), false, bluetoothGattCallback);

Gareth Murfin

unread,
Aug 30, 2019, 2:48:47 PM8/30/19
to CodenameOne Discussions
Yes, I got it working by adjusting that one line my fix is listed here https://github.com/chen-fishbein/bluetoothle-codenameone/issues/13

ben.t...@gmail.com

unread,
Aug 31, 2019, 11:15:46 AM8/31/19
to CodenameOne Discussions
I have used the library to connect to an ESP32 connected to a flow meter via ble. I had to allow location and storage for the cn1 app in the app settings to get it to connect.
Reply all
Reply to author
Forward
0 new messages