Page 1 of 1

BLE-Discovery not working for Cordova build on Android

Posted: 14:52, 16 Jan 2015
by garysims
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.

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

Posted: 15:33, 22 Jan 2015
by garysims
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

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

Posted: 16:06, 22 Jan 2015
by Fredrik
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.

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

Posted: 08:30, 24 Jan 2015
by garysims
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.

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

Posted: 01:07, 05 May 2015
by Amman
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

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

Posted: 15:30, 05 May 2015
by Fredrik
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.

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

Posted: 16:47, 06 May 2015
by Amman
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

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

Posted: 17:02, 06 May 2015
by Fredrik
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.