- nodejs >=4.2.3
- npm >= 2.14.7
- cordova >= 6.2.0
- git
- xcode >=7
- xcode command line tools
- Android SDK
To check the requirements after installation use cordova requirements.
- npm install -g cordova
- git clone https://github.com/twogather/inbeacon-cordova-example.git
- cd inbeacon-cordova-example
- cordova platform add ios
- cordova run ios --device (a device must be attached to your mac, otherwise it starts a simulator)
- npm install -g cordova
- git clone https://github.com/twogather/inbeacon-cordova-example.git
- cd inbeacon-cordova-example
- cordova platform add android
- cordova run android (Uses attached device if available, otherwise runs on emulator)
Installing the plugin using Cordova v3 or older requires an additional step (5).
- npm install -g cordova
- git clone https://github.com/twogather/inbeacon-cordova-example.git
- cd inbeacon-cordova-example
- cordova platform add android
- copy inBeacon SDK and dependencies (.jar files) to folder
platforms/android/libs/
Download the inBeacon SDK and it's dependencies:
- com.inbeacon:android.sdk:1.+
- com.android.support:support v4:22.2.0
- org.altbeacon:android beacon library:2.8.1
- com.loopj.android:android async http:1.4.9
You need to add the .jar files of these libraries.
Some libraries, like the inBeacon SDK, are distributed as an .aar file. This file can be unzipped like any other .zip file. Extract the classes.jar file from this .aar archive, and rename it to something like 'inBeaconSDK1.5.jar'.
Place the 4 .jar files in the directory platforms/android/libs/ and continue as usual.
- cordova run android (Uses attached device if available, otherwise runs on emulator)
To get connected with inBeacon API you'll need a working clientId and secret which you can add/edit under the settings page:
You can also edit the defaults in www/js/index.js at line number 21
var app = {
clientId : 'your-clientid',
secret : 'your-secret',
...
}
and repeat step 5 from Install & run
To enable full background mode open it in Xcode from platforms/ios/HelloCordova.xcodeproj and change the Background Modes settings under Capabilities