ble example does not find devices

85 views
Skip to first unread message

fro...@barachant.com

unread,
May 2, 2017, 11:21:56 AM5/2/17
to CodenameOne Discussions
IDE: NetBeans 8.2
Desktop OS win10
Simulator nope
Device lenowo pb2-690m & samsung galaxy tab 2. both are android 6.0.1

Hi.
I've been debugging original (https://github.com/chen-fishbein/bluetoothle-codenameone/tree/master/BTDemo) version and a debug one of the BLE example and failed.
Basically, all is fine, inits are ok,  (contrarly to him http://stackoverflow.com/questions/43217757/codenameone-ble-initialize-on-ios even if i'm not on IOS yet) but scanning does not return anything.

I have a BLE system that is seen by android's bluetooth preferences, but scanning using the app shows nothing.
My debug version shows that scanning is running (constant timer that checks for isScanning() ) but i never get any event.

Should the example still be fine?

Thank you.

Shai Almog

unread,
May 3, 2017, 12:51:04 AM5/3/17
to CodenameOne Discussions, fro...@barachant.com
Hi,
are you sure it's a bluetooth LE device and not a Bluetooth device?
Notice the methods are all asynchronous and work based on callbacks which aren't delivered on the EDT.

Froogle

unread,
May 3, 2017, 2:33:16 AM5/3/17
to CodenameOne Discussions, fro...@barachant.com
Hi.
I am certain this is a BLE device. In the android bluetooth panel -on that same device-, i can see my BLE target hardware.

Froogle

unread,
May 3, 2017, 3:00:17 AM5/3/17
to CodenameOne Discussions, fro...@barachant.com
An i have also installed a BLE peripheral simulator on my device. It is correctly detected by other devices as a ble service source.
That means the device the code runs on is able to see and share services, but the codenameOne app is not able to see anything from anyone.

And i tested on two devices. Each is able to see the others BLE peripheral simulator in the bluetooth preferences pane.
None of them display anything in the codenameone BLE example application.


On Wednesday, May 3, 2017 at 6:51:04 AM UTC+2, Shai Almog wrote:

Shai Almog

unread,
May 4, 2017, 1:03:51 AM5/4/17
to CodenameOne Discussions, fro...@barachant.com
I'm not familiar enough with BLE, maybe Steve has an idea.

Froogle

unread,
May 4, 2017, 3:36:08 AM5/4/17
to CodenameOne Discussions, fro...@barachant.com
That would be nice. I am really looking forward this platform and i need that part to work first.

Steve Hannah

unread,
May 4, 2017, 5:33:38 PM5/4/17
to codenameone...@googlegroups.com, fro...@barachant.com
It is possible that the library needs to be updated to support Android 6 permissions (i.e. it needs to prompt the user for permissions to access bluetooth).

Do you have any Android 5 devices you can test with to confirm that it works there?

Steve



--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/eda1eff6-ee82-4b1d-8500-9355aa567ba4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

Shai Almog

unread,
May 5, 2017, 12:53:17 AM5/5/17
to CodenameOne Discussions, fro...@barachant.com
You don't need an Android 5 device to test that theory.
Define the build hint: android.targetSDKVersion=21

If it solves the issue then we need to update the cn1lib for Marshmallow permissions.

Froogle

unread,
May 5, 2017, 2:53:41 AM5/5/17
to CodenameOne Discussions, fro...@barachant.com
Yes! compiling to sdk21 worked...
Thanks. At least now i have a workaround and i can progress..

Shai Almog

unread,
May 6, 2017, 1:39:13 AM5/6/17
to CodenameOne Discussions, fro...@barachant.com
Can you please file an issue on the project?
We will need to address that.

Froogle

unread,
May 9, 2017, 3:57:07 AM5/9/17
to CodenameOne Discussions, fro...@barachant.com
Hello.

Thanks for your help on this.
Reply all
Reply to author
Forward
0 new messages