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!
App works fine in the client, does nothing in native
-
- Posts: 2
- Joined: 06:05, 16 Jun 2015
Re: App works fine in the client, does nothing in native
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
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 ?
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
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:
I recompiled the native app (cordova build android) and used adb to upload the apk for testing. It worked perfectly.
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
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
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
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?
Anyone know how to get BLE working when compiled on a phone?
Re: App works fine in the client, does nothing in native
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-ble
I then recompiled my app with:
cordova run
and everything started working.
This was for an Android app.
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-ble
I 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
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
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
Who is online
Users browsing this forum: No registered users and 6 guests