App works fine in the client, does nothing in native

Discuss mobile apps for Texas Instruments products.
fmaertens
Posts: 3
Joined: 20:34, 07 Jun 2015

App works fine in the client, does nothing in native

Postby fmaertens » 20:48, 07 Jun 2015

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!

joaocorreia
Posts: 2
Joined: 06:05, 16 Jun 2015

Re: App works fine in the client, does nothing in native

Postby joaocorreia » 06:08, 19 Jun 2015

I have a similar problem with iOS, I think maybe a plugin is missing, my problem is I dont know which. Any ideas?

fmaertens
Posts: 3
Joined: 20:34, 07 Jun 2015

Re: App works fine in the client, does nothing in native

Postby fmaertens » 15:18, 21 Jun 2015

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 ?

fmaertens
Posts: 3
Joined: 20:34, 07 Jun 2015

Re: App works fine in the client, does nothing in native

Postby fmaertens » 16:37, 21 Jun 2015

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.

lb96
Posts: 18
Joined: 11:32, 06 Jul 2015

Re: App works fine in the client, does nothing in native

Postby lb96 » 11:34, 06 Jul 2015

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

s1930
Posts: 4
Joined: 13:34, 06 Jul 2015

Re: App works fine in the client, does nothing in native

Postby s1930 » 13:38, 06 Jul 2015

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?

s1930
Posts: 4
Joined: 13:34, 06 Jul 2015

Re: App works fine in the client, does nothing in native

Postby s1930 » 14:59, 06 Jul 2015

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.

lb96
Posts: 18
Joined: 11:32, 06 Jul 2015

Re: App works fine in the client, does nothing in native

Postby lb96 » 16:01, 06 Jul 2015

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


Return to “Texas Instruments”

Who is online

Users browsing this forum: No registered users and 5 guests