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.
Different behavior between Evothings Client and native app?
Different behavior between Evothings Client and native app?
Last edited by sarkreth on 17:34, 19 Nov 2015, edited 1 time in total.
Re: Different behavior between Evothings Client and native app?
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:
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.
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?
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.
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?
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.
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.
-
- Posts: 6
- Joined: 15:42, 28 May 2015
Re: Different behavior between Evothings Client and native app?
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
Mike
Return to “Questions and answers”
Who is online
Users browsing this forum: No registered users and 27 guests