Nearables in Cordova

Hi,

I am using the Cordova plugin https://github.com/petermetz/cordova-plugin-ibeacon in an Ionic project to work with iBeacons. This works great. However, after getting some stickers I wanted to work with the nearables protocol so I added the plugin https://github.com/evothings/phonegap-estimotebeacons to add this protocol to my App.

While the installation is fine I get an error: “Blueooth is not powerd on” (the typos are in the error message). This message comes from the library …/Plugins/cordova-plugin-estimote/EstimoteSDK.framework/Versions/A/EstimoteSDK

Of course Bluetooth is on since the iBeacons are working. I double checked in the App but Bluetooth is definitely on. I also removed the Cordova iBeacon plugin (perhaps both plugins are competing for Bluetooth) but that does not change.

Any suggestions?

regards

Hmm, I probably need to make a simple “hello world” Cordova app w/ beacons one day myself (:

Where exactly do you get this “Blueooth is not powerd on” error message?

At first I ensure that BT is on (although it is on but better safe than sorry):

cordova.plugins.BluetoothStatus.initPlugin();
cordova.plugins.BluetoothStatus.enableBT();

Then I define two callback functions:

function onMonitor(state) { console.log("*** FOUND: "+state.length); }
function rangeError(errorMessage) { console.log('Range error: ' + errorMessage); }

Finally I start ranging for nearables with this command:

    estimote.nearables.startRangingForType(estimote.nearables.NearableTypeAll,onMonitor,rangeError);

Once this function ls called the rangeError callback gives the error message I mentioned.
Is there some kind of initialisation I need to do perhaps?

It would also help to know why this particular error message is returned. I can see that it comes from the library but since the library is binary I cannot see why it was raised. And given that the error message does not comply with the actual situation (since BT is on) it is confusing…

regards

Looks like a potential bug in the Cordova plugin. Maybe you can report it to the project’s maintainers:

(Please note that this plugin is not maintained by Estimote.)

Found it!

It seems that the Cordova plugin (com.unarin.cordova.beacon) is not happy to work with the EvoThings plugin. The first one only supports iBeacons while the second one supports both iBeacons and Nearables. So the solution is to select the EvoThings plugin from https://github.com/evothings/phonegap-estimotebeacons

2 Likes