Page 1 of 1
App works fine in the client, does nothing in native
Posted: 20:48, 07 Jun 2015
by fmaertens
I've built an app that reads the sensors out of a TI CC2560 tag, using the TI SensorTag JavaScript library. When using the WorkBench and EvoThings client on my mobile (Android), everything runs fine. Because I want to distribute it using an APK, I've used Cordova to build a native APK.
When running the APK on my mobile, it seems as if all the UI stuff is working, but when I want to access the sensors/tag, it simply does nothing (doesn't crash either). Anyone else had similar issues when building evothings based stuff into a native APK?
Any hint is deeply appreciated!
Re: App works fine in the client, does nothing in native
Posted: 06:08, 19 Jun 2015
by joaocorreia
I have a similar problem with iOS, I think maybe a plugin is missing, my problem is I dont know which. Any ideas?
Re: App works fine in the client, does nothing in native
Posted: 15:18, 21 Jun 2015
by fmaertens
The adb logcat gives me following information when I want to start the Bluetooth scanning/connection:
D/CordovaLog( 6648): file:///android_asset/www/index.html: Line 163 : Uncaught TypeError: Cannot read property 'connectToNearestDevice' of undefined
I/chromium( 6648): [INFO:CONSOLE(163)] "Uncaught TypeError: Cannot read property 'connectToNearestDevice' of undefined", source: file:///android_asset/www/index.html (163)
I was hoping if anyone else had similar problems turning Evothings JS code into native code, using Cordova ?
Re: App works fine in the client, does nothing in native
Posted: 16:37, 21 Jun 2015
by fmaertens
I may have found the answer to my problem:
It seemed as if the required plugin was missing. More specifically, the Evothings BLE plugin for cordova. Although it was installed on the build environment, the config.xml didn't include it.
I added following lines to config.xml and cleared the ant-build folder:
Code: Select all
<js-module src="ble.js" name="BLE">
<clobbers target="evothings.ble" />
</js-module>
I recompiled the native app (cordova build android) and used adb to upload the apk for testing. It worked perfectly.
Re: App works fine in the client, does nothing in native
Posted: 11:34, 06 Jul 2015
by lb96
Hi
I too have come across this problem when trying to build native iPhone apps. I have tried the above but is doesn't seem to work.
Anyone got any suggestions?
Regards
LB
Re: App works fine in the client, does nothing in native
Posted: 13:38, 06 Jul 2015
by s1930
I am having the same issue. I am using the ti-sensortag-sensors example that I modified and it works when using the EvothingsWorkbench but fails to use ble (app is using easyble) when compiled on the Android phone. It looks to be a config file or easy-ble plugin issue but I don't know how to fix it.
Anyone know how to get BLE working when compiled on a phone?
Re: App works fine in the client, does nothing in native
Posted: 14:59, 06 Jul 2015
by s1930
Fixed the Issue.
For others who run into this, I had to add the plugin to the project by opening a command prompt at my app folder (c:\Users\myname\TItemp) (app is caled TItemp that I built) and then running the command:
cordova plugin add
https://github.com/evothings/cordova-bleI then recompiled my app with:
cordova run
and everything started working.
This was for an Android app.
Re: App works fine in the client, does nothing in native
Posted: 16:01, 06 Jul 2015
by lb96
Hi
I'm a bit new to using cordova so I'm not really understanding what you are saying here. Do you have a simple cordova app using javascript I can use as an example