Last Updated 15-October-2014
The plugin is distributed via Github.
To add the plugin to your project, run the following command:
$ cordova plugin add https://github.com/RadiusNetworks/proximitykit-plugin-cordova
This will add the plugin to your project's
config.xml file and will copy various files into the native
src directory for your platforms.
For iOS, Proximity Kit uses SQLite internally but just needs the default library included on iOS. So you need to link to it in the project in Xcode manually after the app is built in Cordova/PhoneGap. To do this, open the generated Xcode project found under
ios and follow these steps:
To properly implement the custom application subclass that initiates the beacon monitoring, edit the
AndroidManifest.xml file (
AndroidManifest.xml) to include the proper
android:name tag under
application for the
ProximityKitCordovaAppication class. The application header should look like this:
<application android:name="com.radiusnetworks.cordova.proximitykit.ProximityKitCordovaApplication" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
Adding the plugin will also modify other parts of your
AndroidManifest.xml automatically. Please do not remove the
<uses-permission> elements that are added to this file or the plugin will not work properly.
In order to provide the necessary ProximityKit configuration data to the native apps, download the
ProximityKit.plist (for iOS) and/or
ProximityKit.properties (for Android) for your kit. These files need to be in the following location within your project depending on the platform being built:
|Platform||Location of ProximityKit configuration file|
In addition to placing the
ProximityKit.plist file inside the iOS project's directory structure, you need to add the file to the Xcode project and to the appropriate target:
radiusnetworks.plugins.proximitykit. There are two methods on this object:
watchProximity(successHandler, failureHandler) returns watchId
successHandler is a function that receives a
message object from ProximityKit on a periodic basis. The
message object always has an
eventType associated with it which is a String.
failureHandler is a function that receives a
message containing the failure message as a String.
watchId returned by the call should be stored and eventually passed into
clearWatch when the callbacks are no longer needed.
||ProximityKit synced with the server|
||State determined for region|
||A beacon is in range|
Based on the
eventType, there may be additional items in the
No additional data.
||0 - state unknown, 1 - inside region, 2 - outside region|
Cancels callbacks from ProximityKit. This method should be called with a
watchId previously returned by a call to
||ProximityKit attributes associated with the region|
||Beacon major value|
||Beacon minor value|
||Beacon proximity (0 - unknown, 1 - immediate, 2 - near, 3 - far)|
||ProximityKit attributes associated with the beacon|
A number of constants for the above keys and event types are available via
To remove the plugin from your project, run the following command:
$ cordova plugin rm com.radiusnetworks.cordova.proximitykit
You may also delete the
ProximityKit.properties file(s) from your project directory (and your Xcode project on iOS).
For support questions or other concerns, email email@example.com