Different behavior between Evothings Client and native app?

Ask, and ye shall receive.
sarkreth
Posts: 8
Joined: 00:04, 12 Nov 2015

Different behavior between Evothings Client and native app?

Postby sarkreth » 06:02, 19 Nov 2015

If Bluetooth is turned off on my phone, easyble.startScan() behaves differently depending on whether it's running on the client or as a native app. In the client, I get the pop-up saying "this app wants to turn on Bluetooth", which is what I would want to happen. On the native app, however, the function just fails, without the notification. Did I forget to add a plugin before I built the app, or what?

Edit: To clarify, if Bluetooth is already turned on, then everything works fine. The apps behave identically, i.e. in scanning, connecting, and communicating via BLE.

I'm using Android 5.0.2 on an HTC One M8.
Last edited by sarkreth on 17:34, 19 Nov 2015, edited 1 time in total.

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

Re: Different behavior between Evothings Client and native app?

Postby Fredrik » 11:13, 19 Nov 2015

Point of semantics: the Client is a native app. I assume you refer to a Cordova app you built yourself.

You'll need to add the BLE plugin before building your app, using either of these lines:

Code: Select all

cordova plugin add cordova-plugin-ble
cordova plugin add https://github.com/evothings/cordova-ble


Also worth checking is that your app's AndroidManifest.xml file contains "android.permission.BLUETOOTH" and "android.permission.BLUETOOTH_ADMIN". Without those permissions, Bluetooth will fail even if the plugin is installed.

sarkreth
Posts: 8
Joined: 00:04, 12 Nov 2015

Re: Different behavior between Evothings Client and native app?

Postby sarkreth » 19:59, 19 Nov 2015

I actually do want to get the semantics right, so is the Evothings Client technically a browser, and the two different (but ideally identical) things I'm running are an "in-browser app"; and then a "native app" made when I run "cordova build android"?

Anyway, the plugin is installed and the manifest file contains those permissions, so that's not the issue.

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

Re: Different behavior between Evothings Client and native app?

Postby Fredrik » 10:57, 20 Nov 2015

The Client is a Cordova app. We build it, too, with "cordova build android". In one sense, all Cordova apps are browsers, since they all contain a webview. The Client is perhaps a bit more than most, since it has the address field on the start page and allows fetching pages from any server.

We've encountered this issue, of the BLE plugin not doing anything despite being installed, on several occasions. Unfortunately, we've not found any permanent countermeasure.

I suggest looking at the debug log from your phone ("adb logcat"). There may be something useful in there.

mikepsmith
Posts: 6
Joined: 15:42, 28 May 2015

Re: Different behavior between Evothings Client and native app?

Postby mikepsmith » 17:44, 08 Apr 2016

I had this problem. It is because the plugins used by Cordova are not up to date with the plugins used in the client. I had to manually update my easyble files to fix it.

Mike


Return to “Questions and answers”

Who is online

Users browsing this forum: MSN [Bot] and 3 guests