Application developed in Phonegap for conducting tests using Estimote beacons for location estimation. This app utilizes the plugin created by petermetz, recommended on the Estimote website.
The plugin offers two functionalities for Android:
Ranging Beacons
: Constantly receives packets under the iBeacons protocol. It allows obtaining information about each of the beacons within range. Further details about the obtained information will be discussed below.Monitoring Beacons
: Allows detecting whether we are inside or outside the range or region of the beacons. These functionalities can be performed by specifying which beacon we want to work with (its UUID is indicated), or opting for it to automatically detect nearby beacons.
The configBeacons.js
file shows in detail how these functionalities are achieved.
There is 1 event to consider: didRangeBeaconsInRegion
.
From the Ranging, we can obtain the following data:
Field | Type |
---|---|
UUID | String |
Major | Integer |
Minor | Integer |
Accuracy | Double |
Proximity | String |
RSSI | Double |
TX | Double |
Additionally, the distance data is included. It is calculated based on the values of RSSI and TX.
There are 3 events to consider:
didEnterRegion
: Triggered when the device enters the specified region.didExitRegion
: Triggered when the device exits the specified region. It takes approximately 10 seconds to detect that the device has exited the region.didDetermineStateForRegion
: This event has two possible results: "CLRegionStateInside" and "CLRegionStateOutside". It indicates whether the device is inside or outside the specified region.
Upon entering the region, detection is instantaneous.
phonegap plugin add cordova-plugin-bluetooth-status
phonegap plugin add cordova-plugin-statusbar
phonegap plugin add https://github.com/petermetz/cordova-plugin-ibeacon.git
phonegap platform add android
phonegap build android --verbose
Once this is done, you will find the APK at the following path:
/platform/android/app/build/outputs/apk/debug/app-debug.apk
Ensure that the beacons have the iBeacon mode turned on. To verify, access the beacon settings through the Estimote app.