BLE-Discovery not working for Cordova build on Android

Ask, and ye shall receive.
garysims
Posts: 3
Joined: 14:36, 16 Jan 2015

BLE-Discovery not working for Cordova build on Android

Postby garysims » 14:52, 16 Jan 2015

Hi,

I have been experimenting with Evothings and things have been going really well, but I have a small problem. If I run the BLE-Discovery app from within evothings it works great. But when I do a Cordova build the app doesn't find any BLE devices. The app runs but no devices are found. This is on Android 4.4.

I added the cordova-ble plugin from here https://github.com/evothings/cordova-ble

Any ideas?

Thanks, Gary.

garysims
Posts: 3
Joined: 14:36, 16 Jan 2015

Re: BLE-Discovery not working for Cordova build on Android

Postby garysims » 15:33, 22 Jan 2015

Bump...

Anyone got any ideas? What should I try? The app builds OK and runs, but it just doesn't detect at BLE devices, the EvoThings version does!

HELP!

Gary

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: BLE-Discovery not working for Cordova build on Android

Postby Fredrik » 16:06, 22 Jan 2015

If I was in your situation I would try debugging the app. Logging systems like "adb logcat" and "console.log" can be helpful.

One might look for indications that the scanning has indeed been started. If none can be found the plugin may have not been added correctly to the Cordova app.

garysims
Posts: 3
Joined: 14:36, 16 Jan 2015

Re: BLE-Discovery not working for Cordova build on Android

Postby garysims » 08:30, 24 Jan 2015

Hi,

I managed to get this working now... I removed and added the ble plugin again and I added a set of standard plugins (like org.apache.cordova.network-information) for good measure.

Everything works as expects! :D

Thanks, Gary.

Amman
Posts: 14
Joined: 21:42, 19 Feb 2015

Re: BLE-Discovery not working for Cordova build on Android

Postby Amman » 01:07, 05 May 2015

Hi,

I think I have similar issue, if anyone can help. I am using the RFduino LEDs and the example given. Everything works fine when I am using my android tablet as a client. But I used cordova and downloaded the apk file to my tablet. The app; the buttons and graphics looks great but it is stuck on "Initializing..."

I have the plugins:
com.evothings.ble 0.0.1 "Evothings BLE API"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.network-information 0.2.15 "Network Information"
org.apache.cordova.vibration 0.3.13 "Vibration"

Am I missing a plugin for the RFduino or any ideas why it is stuck on "Initializing..."


Thanks

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: BLE-Discovery not working for Cordova build on Android

Postby Fredrik » 15:30, 05 May 2015

Generally, if an app is not working as expected, and there is insufficient information, you can look at the console log, and the app's source code, and add some more logging code in appropriate places.

Amman
Posts: 14
Joined: 21:42, 19 Feb 2015

Re: BLE-Discovery not working for Cordova build on Android

Postby Amman » 16:47, 06 May 2015

Thanks Fredrik,

Can you please give me a little bit more guidance how to check or look for the trouble point using the console log? ( I am a newbie using Cordova and developing android apps)

One thing i understood from the problem; the Js code given by Evothings works great if i am using my device as a client and the "Press the yellow button to connect" message comes up right-away. But, I couldn't understand why the code could not pass beyond the "Initializing..." message when I am using the apk file and downloaded it on the tablet. Why would it stuck there?

This is the snippet of the index file given by Evothings.
.
.
.

<!--<button class="menu" onclick=""><img src="ui/images/menu.svg" /></button>-->
</header>

<h1>RFduino LED On/Off</h1>

<p id="info" class="lead">Initializing...</p>

<button type="button" class="yellow" onclick="app.connect()">
Connect
</button>


<button type="button" class="blue" onclick="app.ledOn()">
Blue Led On
</button>
.
.
.

Thank you

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: BLE-Discovery not working for Cordova build on Android

Postby Fredrik » 17:02, 06 May 2015

For Android devices: connect it to your computer and run "adb logcat -c && adb logcat" (requires the Android SDK).

I can't give much advice on recognizing interesting things, but usually if an error occurs, you should see an exception stack trace, hopefully with some relevant message at the top.


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 11 guests