Page 1 of 1

Different behavior between Evothings Client and native app?

Posted: 06:02, 19 Nov 2015
by sarkreth
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.

Re: Different behavior between Evothings Client and native app?

Posted: 11:13, 19 Nov 2015
by Fredrik
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.

Re: Different behavior between Evothings Client and native app?

Posted: 19:59, 19 Nov 2015
by sarkreth
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.

Re: Different behavior between Evothings Client and native app?

Posted: 10:57, 20 Nov 2015
by Fredrik
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.

Re: Different behavior between Evothings Client and native app?

Posted: 17:44, 08 Apr 2016
by mikepsmith
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