├── .gitignore ├── README.md ├── plugin.xml ├── src ├── android │ ├── ProximityKitCordovaApplication.java │ ├── ProximityKitPlugin.java │ ├── android-beacon-library.jar │ ├── greendao-1.3.7.jar │ └── proximitykit-android.jar └── ios │ ├── ProximityKit.framework │ ├── Headers │ │ ├── ProximityKit.h │ │ ├── RPKAnalyticsEvent.h │ │ ├── RPKBeacon.h │ │ ├── RPKBeaconRegion.h │ │ ├── RPKCircle.h │ │ ├── RPKKit.h │ │ ├── RPKLogger.h │ │ ├── RPKManager.h │ │ ├── RPKManagerDelegate.h │ │ ├── RPKMap.h │ │ └── RPKRegion.h │ ├── Info.plist │ ├── Modules │ │ └── module.modulemap │ ├── ProximityKit │ └── _CodeSignature │ │ ├── CodeDirectory │ │ ├── CodeRequirements │ │ ├── CodeResources │ │ └── CodeSignature │ ├── RPKCDVPlugin.h │ └── RPKCDVPlugin.m └── www └── proximitykit.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .DS_Store 3 | *.swp 4 | *~.nib 5 | build/ 6 | *.pbxuser 7 | *.perspective 8 | *.perspectivev3 9 | *.mode1v3 10 | *.mode2v3 11 | xcuserdata 12 | *.xccheckout 13 | *.xcuserstate 14 | *.xcbkptlist 15 | PKGap* 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ProximityKit Plugin for Cordova/PhoneGap 2 | ======================================== 3 | 4 | Last Updated 19-February-2016 5 | 6 | Installation 7 | ------------ 8 | The plugin is distributed via Github. 9 | 10 | To add the plugin to your project, run the following command: 11 | 12 | ``` 13 | $ cordova plugin add https://github.com/RadiusNetworks/proximitykit-plugin-cordova 14 | ``` 15 | 16 | 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. 17 | 18 | ### Android only 19 | 20 | To properly implement the custom application subclass that initiates the beacon monitoring, edit the `AndroidManifest.xml` file (`platforms`/`android`/`AndroidManifest.xml`) to include the proper `android:name` tag under `application` for the `ProximityKitCordovaAppication` class. The application header should look like this: 21 | 22 | 23 | 24 | Adding the plugin will also modify other parts of your `AndroidManifest.xml` automatically. Please do not remove the ``, ``, and `` elements that are added to this file or the plugin will not work properly. 25 | 26 | 27 | ProximityKit Integration 28 | --- 29 | 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: 30 | 31 | | Platform | Location of ProximityKit configuration file | 32 | |:---------|:----------------------------------------------------| 33 | | iOS | `./platforms/ios//ProximityKit.plist` | 34 | | Android | `./platforms/android/src/ProximityKit.properties` | 35 | 36 | ### iOS only 37 | 38 | 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: 39 | 40 | 1. Open the project in Xcode 41 | 2. Select the App's target and select "Add Files to "..." from the File menu. 42 | 3. Locate your ProximityKit.plist file and click "Add" 43 | 44 | Lastly, in order to use Location Services with iOS 8 you will need to add a 'NSLocationAlwaysUsageDescription' string to the 'Info.plist' file in your iOS app. Without this, your device will not send beacon information to your app. The screenshot below shows an example of this: 45 | 46 | 47 | 48 | 49 | Usage 50 | ----- 51 | By successfully adding the ProximityKit plugin to your project, there is no need to explicitly require any ProximityKit Javascript files in your own code. The plugin manifests itself in Javascript as `radiusnetworks.plugins.proximitykit`. There are two methods on this object: `watchProximity` and `clearWatch`. 52 | 53 | ### `watchProximity(successHandler, failureHandler) returns watchId` 54 | 55 | `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. 56 | 57 | `eventType` values: 58 | 59 | |Value | Event | 60 | |:------------------|:------------------------------------| 61 | |`didSync` | ProximityKit synced with the server | 62 | |`didDetermineState`| State determined for region | 63 | |`didEnterRegion` | Region entered | 64 | |`didExitRegion` | Region exited | 65 | |`didRangeBeacon` | A beacon is in range | 66 | 67 | Based on the `eventType`, there may be additional items in the `message`. 68 | 69 | `didSync` 70 | 71 | No additional data. 72 | 73 | `didDetermineState` 74 | 75 | Additional data: 76 | 77 | |Value | Description | 78 | |:------------------|:---------------------------------------------------------| 79 | |`regionState` | 0 - state unknown, 1 - inside region, 2 - outside region | 80 | |`region` | Region data | 81 | 82 | `didEnterRegion` 83 | `didExitRegion` 84 | 85 | Additional data: 86 | 87 | |Value | Description | 88 | |:------------------|:---------------------------------------------------------| 89 | |`region` | Region data | 90 | 91 | `didRangeBeacon` 92 | 93 | Additional data: 94 | 95 | |Value | Description | 96 | |:------------------|:---------------------------------------------------------| 97 | |`beacon` | Beacon data | 98 | 99 | 100 | 101 | ### `clearWatch(watchId)` 102 | 103 | Cancels callbacks from ProximityKit. This method should be called with a `watchId` previously returned by a call to `watchProximity`. 104 | 105 | ### Region Data 106 | 107 | |Value | Description | 108 | |:------------------|:---------------------------------------------------------| 109 | |`name` | Region name | 110 | |`identifier` | Region UUID | 111 | |`attributes` | ProximityKit attributes associated with the region | 112 | 113 | 114 | ### Beacon Data 115 | 116 | |Value | Description | 117 | |:------------------|:---------------------------------------------------------| 118 | |`uuid` | Beacon UUID | 119 | |`major` | Beacon major value | 120 | |`minor` | Beacon minor value | 121 | |`rssi` | Beacon RSSI | 122 | |`proximity` | Beacon proximity (0 - unknown, 1 - immediate, 2 - near, 3 - far) | 123 | |`attributes` | ProximityKit attributes associated with the beacon | 124 | 125 | ### Constants 126 | 127 | A number of constants for the above keys and event types are available via `radiusnetworks.plugins.proximitykit.constants`. 128 | 129 | Removal 130 | ------- 131 | 132 | To remove the plugin from your project, run the following command: 133 | 134 | ``` 135 | $ cordova plugin rm com.radiusnetworks.cordova.proximitykit 136 | ``` 137 | 138 | You may also delete the `ProximityKit.plist` and/or `ProximityKit.properties` file(s) from your project directory (and your Xcode project on iOS). 139 | 140 | Reference Implementation 141 | ------- 142 | 143 | A reference Cordova project implementing the Proximity Kit plugin can be found [here](https://github.com/RadiusNetworks/hello-proximity-cordova). Clone this project and follow the steps to be detecting beacons in both iOS and Android in minutes. 144 | 145 | Support 146 | ------- 147 | 148 | For support questions or other concerns, email support@radiusnetworks.com 149 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | ProximityKit 6 | Proximity Kit Plugin for PhoneGap/Cordova 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/android/ProximityKitCordovaApplication.java: -------------------------------------------------------------------------------- 1 | package com.radiusnetworks.cordova.proximitykit; 2 | 3 | import android.util.Log; 4 | import android.app.Application; 5 | 6 | import com.radiusnetworks.proximity.ProximityKitManager; 7 | import com.radiusnetworks.proximity.ProximityKitMonitorNotifier; 8 | import com.radiusnetworks.proximity.ProximityKitRangeNotifier; 9 | import com.radiusnetworks.proximity.ProximityKitSyncNotifier; 10 | import com.radiusnetworks.proximity.ProximityKitBeacon; 11 | import com.radiusnetworks.proximity.ProximityKitBeaconRegion; 12 | 13 | import java.util.Collection; 14 | 15 | 16 | public class ProximityKitCordovaApplication extends Application implements ProximityKitRangeNotifier, ProximityKitSyncNotifier, ProximityKitMonitorNotifier { 17 | 18 | private static ProximityKitManager pkManager; 19 | private ProximityKitPlugin pkPlugin = null; 20 | 21 | @Override 22 | public void onCreate() 23 | { 24 | super.onCreate(); 25 | Log.d(TAG, "onCreate"); 26 | pkManager = ProximityKitManager.getInstanceForApplication(this); 27 | pkManager.setProximityKitSyncNotifier(this); 28 | pkManager.setProximityKitMonitorNotifier(this); 29 | pkManager.setProximityKitRangeNotifier(this); 30 | pkManager.getBeaconManager().setDebug(true); 31 | pkManager.start(); 32 | } 33 | 34 | private static final String TAG = "ProximityKitCordovaApplication"; 35 | 36 | public void setPkPlugin(ProximityKitPlugin plugin) { 37 | pkPlugin = plugin; 38 | } 39 | 40 | @Override 41 | public void didRangeBeaconsInRegion(Collection beacons, ProximityKitBeaconRegion region) { 42 | Log.d(TAG, "didRangeBeaconsInRegion"); 43 | if (pkPlugin != null) { 44 | pkPlugin.didRangeBeaconsInRegion(beacons, region); 45 | } 46 | } 47 | 48 | @Override 49 | public void didEnterRegion(ProximityKitBeaconRegion region) { 50 | Log.d(TAG, "didEnterRegion"); 51 | if (pkPlugin != null) { 52 | pkPlugin.didEnterRegion( region); 53 | } 54 | } 55 | 56 | @Override 57 | public void didExitRegion(ProximityKitBeaconRegion region) { 58 | Log.d(TAG, "didExitRegion"); 59 | if (pkPlugin != null) { 60 | pkPlugin.didExitRegion( region); 61 | } 62 | } 63 | 64 | @Override 65 | public void didDetermineStateForRegion(int state, ProximityKitBeaconRegion region) { 66 | Log.d(TAG, "didDetermineStateForRegion"); 67 | if (pkPlugin != null) { 68 | pkPlugin.didDetermineStateForRegion(state, region); 69 | } 70 | } 71 | 72 | @Override 73 | public void didSync() 74 | { 75 | Log.d(TAG, "didSync"); 76 | if (pkPlugin != null) { 77 | pkPlugin.didSync(); 78 | } 79 | } 80 | 81 | @Override 82 | public void didFailSync(Exception e) 83 | { 84 | Log.d(TAG, "didFailSync"); 85 | if (pkPlugin != null) { 86 | pkPlugin.didFailSync( e); 87 | } 88 | } 89 | 90 | public ProximityKitManager getProximityKitManager() { 91 | 92 | return pkManager; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/android/ProximityKitPlugin.java: -------------------------------------------------------------------------------- 1 | package com.radiusnetworks.cordova.proximitykit; 2 | 3 | import android.util.Log; 4 | 5 | import org.apache.cordova.CordovaPlugin; 6 | import org.apache.cordova.CallbackContext; 7 | import org.apache.cordova.CordovaInterface; 8 | import org.apache.cordova.CordovaWebView; 9 | import org.apache.cordova.PluginResult; 10 | 11 | import org.json.JSONArray; 12 | import org.json.JSONException; 13 | import org.json.JSONObject; 14 | 15 | import org.altbeacon.beacon.Beacon; 16 | import org.altbeacon.beacon.BeaconData; 17 | import org.altbeacon.beacon.Region; 18 | import org.altbeacon.beacon.client.DataProviderException; 19 | 20 | import com.radiusnetworks.proximity.ProximityKitManager; 21 | import com.radiusnetworks.proximity.ProximityKitMonitorNotifier; 22 | import com.radiusnetworks.proximity.ProximityKitRangeNotifier; 23 | import com.radiusnetworks.proximity.ProximityKitSyncNotifier; 24 | import com.radiusnetworks.proximity.ProximityKitBeacon; 25 | import com.radiusnetworks.proximity.ProximityKitBeaconRegion; 26 | import com.radiusnetworks.proximity.beacon.data.proximitykit.PkBeaconData; 27 | 28 | import java.util.Collection; 29 | import java.util.HashMap; 30 | import java.util.Iterator; 31 | import java.util.Map; 32 | 33 | public class ProximityKitPlugin extends CordovaPlugin implements ProximityKitRangeNotifier, ProximityKitSyncNotifier, ProximityKitMonitorNotifier { 34 | 35 | public static final String ACTION_WATCH = "watchProximity"; 36 | public static final String ACTION_CLEAR_WATCH = "clearWatch"; 37 | 38 | public static final String EVENT_TYPE_KEY = "eventType"; 39 | public static final String EVENT_TYPE_SYNCED = "didSync"; 40 | public static final String EVENT_TYPE_ENTERED_REGION = "didEnterRegion"; 41 | public static final String EVENT_TYPE_EXITED_REGION = "didExitRegion"; 42 | public static final String EVENT_TYPE_DETERMINED_REGION_STATE = "didDetermineState"; 43 | public static final String EVENT_TYPE_RANGED_BEACONS = "didRangeBeacon"; 44 | 45 | public static final String EVENT_REGION_KEY = "region"; 46 | public static final String EVENT_REGION_NAME_KEY = "name"; 47 | public static final String EVENT_REGION_UUID_KEY = "uuid"; 48 | public static final String EVENT_REGION_MAJOR_KEY = "major"; 49 | public static final String EVENT_REGION_MINOR_KEY = "minor"; 50 | public static final String EVENT_REGION_IDENTIFIER_KEY = "identifier"; 51 | public static final String EVENT_REGION_ATTRIBUTES_KEY = "attributes"; 52 | public static final String EVENT_REGION_STATE_KEY = "state"; 53 | 54 | public static final String EVENT_BEACONS_KEY = "beacons"; 55 | public static final String EVENT_BEACON_KEY = "beacon"; 56 | 57 | public static final String EVENT_BEACON_UUID_KEY = "uuid"; 58 | public static final String EVENT_BEACON_MAJOR_KEY = "major"; 59 | public static final String EVENT_BEACON_MINOR_KEY = "minor"; 60 | public static final String EVENT_BEACON_RSSI_KEY = "rssi"; 61 | public static final String EVENT_BEACON_ATTRIBUTES_KEY = "attributes"; 62 | public static final String EVENT_BEACON_IDENTIFIER_KEY = "identifier"; 63 | public static final String EVENT_BEACON_MANUFACTURER_KEY = "manufacturer"; 64 | public static final String EVENT_BEACON_DISTANCE_KEY = "distance"; 65 | 66 | private static ProximityKitManager pkManager; 67 | 68 | public HashMap watches = new HashMap(); 69 | private boolean running = false; 70 | private ProximityKitCordovaApplication application; 71 | 72 | @Override 73 | public void initialize(CordovaInterface cordova, CordovaWebView webView) 74 | { 75 | super.initialize(cordova, webView); 76 | application = (ProximityKitCordovaApplication)cordova.getActivity().getApplicationContext(); 77 | application.setPkPlugin(this); 78 | pkManager = application.getProximityKitManager(); 79 | } 80 | 81 | @Override 82 | public void onDestroy() 83 | { 84 | super.onDestroy(); 85 | //pkManager.stop(); 86 | } 87 | 88 | @Override 89 | public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { 90 | Log.d(TAG, "execute: action is " + action + ", args is " + args.toString()); 91 | boolean handled = false; 92 | if (action.equals(ACTION_WATCH)) { 93 | String watchId = args.getString(0); 94 | this.watchProximity(watchId, callbackContext); 95 | handled = true; 96 | } 97 | else if (action.equals(ACTION_CLEAR_WATCH)) { 98 | String watchId = args.getString(0); 99 | this.clearWatch(watchId, callbackContext); 100 | handled = true; 101 | } 102 | return handled; 103 | } 104 | 105 | private void watchProximity(String watchId, CallbackContext callbackContext) { 106 | addWatch(watchId, callbackContext); 107 | }; 108 | 109 | private void clearWatch(String watchId, CallbackContext callbackContext) { 110 | removeWatch(watchId); 111 | }; 112 | 113 | private void addWatch(String timerId, CallbackContext callbackContext) { 114 | watches.put(timerId, callbackContext); 115 | } 116 | 117 | private void removeWatch(String timerId) { 118 | if (watches.containsKey(timerId)) { 119 | watches.remove(timerId); 120 | } 121 | if (watches.size() == 0) { 122 | stop(); 123 | } 124 | } 125 | 126 | public void success(JSONObject message, CallbackContext callbackContext, boolean keepCallback) { 127 | PluginResult result = new PluginResult(PluginResult.Status.OK, message); 128 | result.setKeepCallback(keepCallback); 129 | callbackContext.sendPluginResult(result); 130 | } 131 | 132 | private void sendSuccessMessageToAllWatches(JSONObject jsonMessage) 133 | { 134 | Iterator it = this.watches.values().iterator(); 135 | while (it.hasNext()) { 136 | success(jsonMessage, it.next(), true); 137 | } 138 | } 139 | 140 | private void start() { 141 | if (! running) { 142 | Log.d(TAG, "Starting pkManager"); 143 | running = true; 144 | pkManager.start(); 145 | } 146 | } 147 | 148 | private void stop() { 149 | if (running) { 150 | //pkManager.stop(); 151 | running = false; 152 | } 153 | } 154 | 155 | public JSONObject pluginResultDidSync() { 156 | JSONObject o = new JSONObject(); 157 | 158 | try { 159 | o.put(EVENT_TYPE_KEY, EVENT_TYPE_SYNCED); 160 | } catch (JSONException e) { 161 | // TODO Auto-generated catch block 162 | e.printStackTrace(); 163 | } 164 | 165 | return o; 166 | } 167 | 168 | public JSONObject pluginResultDidDetermineState(int state, Region region) { 169 | JSONObject o = new JSONObject(); 170 | 171 | try { 172 | o.put(EVENT_TYPE_KEY, EVENT_TYPE_DETERMINED_REGION_STATE); 173 | o.put(EVENT_REGION_STATE_KEY, state); 174 | o.put(EVENT_REGION_KEY, toJSON(region)); 175 | } catch (JSONException e) { 176 | // TODO Auto-generated catch block 177 | e.printStackTrace(); 178 | } 179 | 180 | return o; 181 | } 182 | 183 | public JSONObject pluginResultDidEnterRegion(Region region) { 184 | JSONObject o = new JSONObject(); 185 | 186 | try { 187 | o.put(EVENT_TYPE_KEY, EVENT_TYPE_ENTERED_REGION); 188 | o.put(EVENT_REGION_KEY, toJSON(region)); 189 | } catch (JSONException e) { 190 | // TODO Auto-generated catch block 191 | e.printStackTrace(); 192 | } 193 | 194 | return o; 195 | } 196 | 197 | public JSONObject pluginResultDidExitRegion(Region region) { 198 | JSONObject o = new JSONObject(); 199 | 200 | try { 201 | o.put(EVENT_TYPE_KEY, EVENT_TYPE_EXITED_REGION); 202 | o.put(EVENT_REGION_KEY, toJSON(region)); 203 | } catch (JSONException e) { 204 | // TODO Auto-generated catch block 205 | e.printStackTrace(); 206 | } 207 | 208 | return o; 209 | } 210 | 211 | public JSONObject pluginResultDidRangeBeacons(Collection beacons, ProximityKitBeaconRegion region) { 212 | JSONObject o = new JSONObject(); 213 | try { 214 | o.put(EVENT_TYPE_KEY, EVENT_TYPE_RANGED_BEACONS); 215 | for (ProximityKitBeacon beacon : beacons) { 216 | o.put(EVENT_BEACON_KEY, toJSON(beacon, region)); 217 | } 218 | } catch (JSONException e) { 219 | // TODO Auto-generated catch block 220 | e.printStackTrace(); 221 | } 222 | 223 | return o; 224 | } 225 | 226 | private static final String TAG = "ProximityKitPlugin"; 227 | 228 | @Override 229 | public void didRangeBeaconsInRegion(Collection beacons, ProximityKitBeaconRegion region) { 230 | sendSuccessMessageToAllWatches(pluginResultDidRangeBeacons(beacons, region)); 231 | } 232 | 233 | @Override 234 | public void didEnterRegion(ProximityKitBeaconRegion region) { 235 | sendSuccessMessageToAllWatches(pluginResultDidEnterRegion(region)); 236 | } 237 | 238 | @Override 239 | public void didExitRegion(ProximityKitBeaconRegion region) { 240 | sendSuccessMessageToAllWatches(pluginResultDidExitRegion(region)); 241 | } 242 | 243 | @Override 244 | public void didDetermineStateForRegion(int state, ProximityKitBeaconRegion region) { 245 | sendSuccessMessageToAllWatches(pluginResultDidDetermineState(state, region)); 246 | } 247 | 248 | @Override 249 | public void didSync() 250 | { 251 | sendSuccessMessageToAllWatches(pluginResultDidSync()); 252 | } 253 | 254 | @Override 255 | public void didFailSync(Exception e) 256 | { 257 | Log.d(TAG, "didFailSync", e); 258 | } 259 | 260 | private JSONObject toJSON(Region region) 261 | { 262 | JSONObject regionJSON = new JSONObject(); 263 | try { 264 | regionJSON.put(EVENT_REGION_UUID_KEY, region.getId1()); 265 | regionJSON.put(EVENT_REGION_MAJOR_KEY, region.getId2()); 266 | regionJSON.put(EVENT_REGION_MINOR_KEY, region.getId3()); 267 | //regionJSON.put(EVENT_REGION_ATTRIBUTES_KEY, new JSONObject(region.getAttributes())); 268 | } catch (JSONException e) { 269 | // TODO Auto-generated catch block 270 | e.printStackTrace(); 271 | } 272 | 273 | return regionJSON; 274 | } 275 | 276 | private JSONObject toJSON(ProximityKitBeacon beacon, ProximityKitBeaconRegion region) 277 | { 278 | JSONObject beaconJSON = new JSONObject(); 279 | try { 280 | beaconJSON.put(EVENT_BEACON_UUID_KEY, beacon.getId1()); 281 | beaconJSON.put(EVENT_BEACON_MAJOR_KEY, beacon.getId2()); 282 | beaconJSON.put(EVENT_BEACON_MINOR_KEY, beacon.getId3()); 283 | beaconJSON.put(EVENT_BEACON_MANUFACTURER_KEY, beacon.getManufacturer()); 284 | beaconJSON.put(EVENT_BEACON_RSSI_KEY, beacon.getRssi()); 285 | beaconJSON.put(EVENT_BEACON_DISTANCE_KEY, beacon.getDistance()); 286 | beaconJSON.put(EVENT_BEACON_ATTRIBUTES_KEY, new JSONObject(beacon.getAttributes())); 287 | } catch (JSONException e) { 288 | // TODO Auto-generated catch block 289 | e.printStackTrace(); 290 | } 291 | 292 | return beaconJSON; 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /src/android/android-beacon-library.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/android/android-beacon-library.jar -------------------------------------------------------------------------------- /src/android/greendao-1.3.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/android/greendao-1.3.7.jar -------------------------------------------------------------------------------- /src/android/proximitykit-android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/android/proximitykit-android.jar -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/ProximityKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // Proximity Kit 3 | // 4 | // Copyright (c) 2013 Radius Networks. All rights reserved. 5 | // 6 | 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKAnalyticsEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProximityKit 3 | // 4 | // Created by Christopher Sexton on 8/15/14. 5 | // Copyright (c) 2014 Radius Networks. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface RPKAnalyticsEvent : NSObject 11 | 12 | + (void)postEvent:(NSString *)type withDetails:(NSDictionary *)details; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKBeacon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | #import 5 | #import "RPKRegion.h" 6 | 7 | /*! 8 | * @interface PKIBeacon 9 | */ 10 | @interface RPKBeacon : RPKRegion 11 | 12 | @property (readonly) NSUUID *uuid; 13 | @property (readonly) NSNumber *major; 14 | @property (readonly) NSNumber *minor; 15 | @property (readonly) NSNumber *rssi; 16 | @property (readonly) CLLocationAccuracy accuracy; 17 | @property (readonly) CLProximity proximity; 18 | @property (readonly) CLBeacon *beacon; 19 | 20 | - (id)initWith:(NSDictionary *)dict; 21 | - (id)initWithBeacon:(CLBeacon *)beacon dict:(NSDictionary *)dict; 22 | @end 23 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKBeaconRegion.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | #import 5 | #import "RPKRegion.h" 6 | 7 | /*! 8 | * @interface PKIBeaconRegion 9 | */ 10 | @interface RPKBeaconRegion : RPKRegion 11 | 12 | @property (readonly) NSUUID *uuid; 13 | @property (readonly) NSNumber *major; 14 | @property (readonly) NSNumber *minor; 15 | @property (readonly) BOOL hasMajor; 16 | @property (readonly) BOOL hasMinor; 17 | @property (readonly) BOOL enableMonitoring; 18 | @property (readonly) BOOL enableRanging; 19 | @property (readonly) BOOL notifyOnEntry; 20 | @property (readonly) BOOL notifyOnExit; 21 | @property (readonly) BOOL notifyEntryStateOnDisplay; 22 | 23 | - (id)initWith:(NSDictionary *)dict; 24 | - (id)initWithRegion:(CLBeaconRegion *)region dict:(NSDictionary *)dict; 25 | - (CLBeaconRegion *)region; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKCircle.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | #import 5 | #import 6 | #import "RPKRegion.h" 7 | 8 | /*! 9 | * @interface PKCircle 10 | * @discussion Contains a circle region defined by GPS coordinates with a 11 | * latitude and longitude. 12 | */ 13 | @interface RPKCircle : RPKRegion 14 | 15 | /*! 16 | * @property latitude 17 | * @discussion The latitude value for the center GPS coordinates 18 | */ 19 | @property (readonly) float latitude; 20 | 21 | /*! 22 | * @property longitude 23 | * @discussion The longitude value for the center GPS coordinates 24 | */ 25 | @property (readonly) float longitude; 26 | 27 | /*! 28 | * @property radius 29 | * @discussion The length of the radius in meters 30 | */ 31 | @property (readonly) float radius; 32 | 33 | - (id)initWith:(NSDictionary *)dict; 34 | - (CLRegion *)region; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKKit.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | #import "RPKMap.h" 5 | #import "RPKRegion.h" 6 | #import "RPKBeacon.h" 7 | #import "RPKBeaconRegion.h" 8 | 9 | /*! 10 | * @interface RPKKit 11 | */ 12 | @interface RPKKit : NSObject 13 | 14 | @property NSString *url; 15 | @property NSInteger id; 16 | @property NSString *name; 17 | @property NSString *statusURL; 18 | @property NSString *statusToken; 19 | 20 | @property NSArray *beaconRegions; 21 | @property RPKMap *map; 22 | @property NSDictionary *json; 23 | @property NSDictionary *config; 24 | 25 | - (id)initWith:(NSDictionary *)dict; 26 | - (RPKRegion *)getRegionForIdentifier:(NSString *)identifier; 27 | - (RPKBeacon *)getIBeaconForCLBeacon:(CLBeacon *)clBeacon; 28 | - (RPKBeaconRegion *)getIBeaconRegionForCLBeaconRegion:(CLBeaconRegion *)clBeaconRegion; 29 | 30 | 31 | - (void)enumerateIBeaconsUsingBlock:(void (^)(RPKBeacon *iBeacon, NSUInteger idx, BOOL *stop))block; 32 | 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKLogger.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProximityKit 3 | // 4 | // Copyright (c) 2013 Radius Networks. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | #define RPKLog(s, ...) \ 10 | [RPKLogger log : __LEVEL__ format : (s), ## __VA_ARGS__] 11 | #define RPKLogEmerg(s, ...) \ 12 | [RPKLogger log : RPKLogLevelEmergency format : (s), ## __VA_ARGS__] 13 | #define RPKLogAlert(s, ...) \ 14 | [RPKLogger log : RPKLogLevelAlert format : (s), ## __VA_ARGS__] 15 | #define RPKLogCrit(s, ...) \ 16 | [RPKLogger log : RPKLogLevelCritical format : (s), ## __VA_ARGS__] 17 | #define RPKLogError(s, ...) \ 18 | [RPKLogger log : RPKLogLevelError format : (s), ## __VA_ARGS__] 19 | #define RPKLogWarn(s, ...) \ 20 | [RPKLogger log : RPKLogLevelWarning format : (s), ## __VA_ARGS__] 21 | #define RPKLogNotice(s, ...) \ 22 | [RPKLogger log : RPKLogLevelNotice format : (s), ## __VA_ARGS__] 23 | #define RPKLogInfo(s, ...) \ 24 | [RPKLogger log : RPKLogLevelInformational format : (s), ## __VA_ARGS__] 25 | #define RPKLogDebug(s, ...) \ 26 | [RPKLogger log : RPKLogLevelDebug format : (s), ## __VA_ARGS__] 27 | 28 | /** PKLogLevel 29 | * 30 | * The enumerated values for the different log levels. Based on syslog. 31 | * 32 | */ 33 | typedef NS_ENUM (NSInteger, RPKLogLevel) 34 | { 35 | /** Emergency: System is unusable */ 36 | RPKLogLevelEmergency = 0, 37 | /** Alert: Action must be taken immediately */ 38 | RPKLogLevelAlert = 1, 39 | /** Critical: Critical conditions */ 40 | RPKLogLevelCritical = 2, 41 | /** Error: Error conditions */ 42 | RPKLogLevelError = 3, 43 | /** Warning: Warning conditions */ 44 | RPKLogLevelWarning = 4, 45 | /** Notice: Normal but significant condition */ 46 | RPKLogLevelNotice = 5, 47 | /** Informational: Informational messages */ 48 | RPKLogLevelInformational = 6, 49 | /** Debug: Debug-level messages */ 50 | RPKLogLevelDebug = 7 51 | }; 52 | 53 | /** RPKLogger 54 | * 55 | * Logging class used internally for Proximity Kit. Can be used to set the 56 | * logging level and see more informative information about the internal 57 | * happenings within the framework. 58 | * 59 | * The default log level is set to `RPKLogLevelError` 60 | * 61 | * This also provides NSLog-like macros for the different levels: 62 | * 63 | * - `RPKLogEmerg(msg,...)` 64 | * - `RPKLogAlert(msg,...)` 65 | * - `RPKLogCrit(msg,...)` 66 | * - `RPKLogError(msg,...)` 67 | * - `RPKLogWarn(msg,...)` 68 | * - `RPKLogNotice(msg,...)` 69 | * - `RPKLogDebug(msg,...)` 70 | * 71 | */ 72 | @interface RPKLogger : NSObject 73 | 74 | /** log:format 75 | * 76 | * Print a log message 77 | * 78 | * `level` The log level 79 | * `format` An NSLog-like formatted message 80 | * 81 | */ 82 | + (void)log:(RPKLogLevel)level format:(NSString *)format, ...; 83 | 84 | /** setLevel: 85 | * 86 | * Sets the global log level for proximity kit. 87 | * 88 | * `level` The log level 89 | */ 90 | + (void)setLevel:(RPKLogLevel)level; 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | #import 5 | #import 6 | #import "RPKManagerDelegate.h" 7 | #import "RPKRegion.h" 8 | #import "RPKKit.h" 9 | #import "RPKLogger.h" 10 | 11 | /** RPKFetchCompletionHandler 12 | * 13 | * Same signature as UIKit's performFetchWithCompletionHandler's block 14 | * 15 | */ 16 | typedef void (^RPKFetchCompletionHandler)(UIBackgroundFetchResult); 17 | 18 | /** RPKManagerNotificationEvent 19 | * 20 | * Enumeration of different event types that can trigger notification from RPKManager. 21 | */ 22 | typedef NS_ENUM (NSInteger, RPKManagerNotificationEvent) { 23 | RPKManagerNotificationEventDidSync, 24 | RPKManagerNotificationEventDidDetermineStateForRegion, 25 | RPKManagerNotificationEventDidEnterRegion, 26 | RPKManagerNotificationEventDidExitRegion, 27 | RPKManagerNotificationEventDidRangeBeaconsInRegion, 28 | RPKManagerNotificationEventDidFailWithError 29 | }; 30 | 31 | // Notifications. 32 | FOUNDATION_EXPORT NSString *const RPKManagerDidDetermineStateForRegionNotification; 33 | FOUNDATION_EXPORT NSString *const RPKManagerDidEnterRegionNotification; 34 | FOUNDATION_EXPORT NSString *const RPKManagerDidExitRegionNotification; 35 | FOUNDATION_EXPORT NSString *const RPKManagerDidRangeBeaconsInRegionNotification; 36 | FOUNDATION_EXPORT NSString *const RPKManagerDidTriggerAnalyticsEvent; 37 | 38 | // Notification user data keys. 39 | FOUNDATION_EXPORT NSString *const RPKManagerNotificationEventKey; 40 | FOUNDATION_EXPORT NSString *const RPKManagerNotificationRegionKey; 41 | FOUNDATION_EXPORT NSString *const RPKManagerNotificationRegionStateKey; 42 | FOUNDATION_EXPORT NSString *const RPKManagerNotificationBeaconsKey; 43 | FOUNDATION_EXPORT NSString *const RPKManagerNotificationAnalyticsEventDetailsKey; 44 | FOUNDATION_EXPORT NSString *const RPKManagerNotificationAnalyticsEventTypeKey; 45 | 46 | 47 | /** RPKManager 48 | * 49 | * This is the main class for used for interacting with the 50 | * Proximity Kit SDK. 51 | * 52 | * More information can be found at http://proximitykit.com 53 | */ 54 | @interface RPKManager : NSObject 55 | 56 | /** getVersion 57 | * 58 | * Get the version string for the Proximity Kit Framework 59 | * 60 | */ 61 | + (NSString *)getVersion; 62 | 63 | /** manager 64 | * 65 | * Creates the manager without a delegate. 66 | * 67 | */ 68 | + (RPKManager *)manager; 69 | 70 | /** managerWithDelegate 71 | * 72 | * Creates the manager, assignes the delegate. 73 | * 74 | */ 75 | + (RPKManager *)managerWithDelegate:(id )delegate; 76 | 77 | /** managerWithDelegate:andConfig 78 | * 79 | * Creates the manager, assignes the delegate, and uses the supplied 80 | * configuration dictionary instead of loading the configuration from 81 | * the plist file. 82 | * 83 | */ 84 | + (RPKManager *)managerWithDelegate:(id )delegate andConfig:(NSDictionary *)config; 85 | 86 | /** managerWithConfig 87 | * 88 | * Creates the manager without a delegate and uses the supplied 89 | * configuration dictionary instead of loading the configuration from 90 | * the plist file. 91 | * 92 | */ 93 | + (RPKManager *)managerWithConfig:(NSDictionary *)config; 94 | 95 | /** logLevel 96 | * Set the logging level. Follows syslog convention of levels 0-7. 97 | * 98 | * See RPKLogger.h for more details 99 | * 100 | * Param: `logLevel` 101 | * 102 | * Can take an integer value between 0 and 7, to represent the log level. 103 | * 104 | *
105 |  * 0 - Emergency: System is unusable
106 |  * 1 - Alert: Action must be taken immediately
107 |  * 2 - Critical: Critical conditions
108 |  * 3 - Error: Error conditions
109 |  * 4 - Warning: Warning conditions
110 |  * 5 - Notice: Normal but significant condition
111 |  * 6 - Informational: Informational messages
112 |  * 7 - Debug: Debug-level messages
113 |  * 
114 | */ 115 | - (void)logLevel:(NSInteger)level; 116 | 117 | 118 | /** start 119 | * 120 | * Sets up the manager and synchronizes data with the server. 121 | * 122 | */ 123 | - (void)start; 124 | 125 | /** stop 126 | * 127 | * Unregister regions and beacons and stop automatic syncing. 128 | * 129 | * While the RPKManager is stopped if `sync` is called the api will be called 130 | * and data downloaded and synced. However, any regions will not be 131 | * registered with CoreLocation. 132 | * 133 | */ 134 | - (void)stop; 135 | 136 | /** sync 137 | * 138 | * Force a sync with the server. This is not normally required. 139 | * 140 | */ 141 | - (void)sync; 142 | 143 | /** syncWithCompletionHandler 144 | * 145 | * Same as `-sync`, but accepts a block for the sync callbacks. This is 146 | * particularly useful for updating the ProximityKit data when the 147 | * application in in the background. 148 | * 149 | * To take advantage of this you need to implement 150 | * `application:performFetchWithCompletionHandler:` on your in your 151 | * application delegate. Then Within that method you can simply call 152 | * `syncWithCompletionHandler` and pass it the compleation block: 153 | * 154 | *
155 |  * - (void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
156 |  * {
157 |  *     // ...
158 |  *     [pkManager syncWithCompletionHandler: completionHandler];
159 |  * }
160 |  * 
161 | * 162 | * Be sure to set the fetch interval in your didFinishLaunching method: 163 | * 164 | *
165 |  * - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
166 |  * {
167 |  *     // ...
168 |  *     [application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];
169 |  *     return YES;
170 |  * }
171 |  * 
172 | * 173 | * 174 | * Finally make sure you add `UIBackgroundModes` to your info plist with a string set to 'fetch' 175 | * 176 | */ 177 | - (void)syncWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler; 178 | 179 | /** delegate 180 | * 181 | * Primary delegate for the RPKManager. 182 | * 183 | */ 184 | @property (assign) id delegate; 185 | 186 | /** locationManager 187 | * 188 | * The instance of CLLocation manager that RPKManager wraps and maintains. 189 | * 190 | */ 191 | @property (readonly) CLLocationManager *locationManager; 192 | 193 | /** locationManagerDelegate 194 | * 195 | * Proxy for all of the CLLocationManager delgate methods. All of the 196 | * non-deprecated methods from CLLocationManagerDelegate will be called 197 | * on this object. 198 | * 199 | * This is useful for accessing the underlying core location functionality 200 | * while using the same locationManager instance that Proximity Kit wraps 201 | * and maintains. 202 | * 203 | */ 204 | @property (assign) id locationManagerDelegate; 205 | 206 | /** kit 207 | * 208 | * The representation of the Kit as defined in the Proximity Kit service. 209 | * This contains lists of iBeacons and Geofences. 210 | * 211 | */ 212 | @property (readonly) RPKKit *kit; 213 | 214 | /** getRegionForIdentifier 215 | * 216 | * Lookup the RPKRegion for a given identifier. 217 | * 218 | * Returns nil if no region found. 219 | * 220 | */ 221 | - (RPKRegion *)getRegionForIdentifier:(NSString *)identifier; 222 | 223 | /** startRangingIBeacons 224 | * 225 | * Start calculating ranges for iBeacons. 226 | * 227 | */ 228 | - (void)startRangingBeacons; 229 | 230 | /** stopRangingIBeacons 231 | * 232 | * Stop calculating ranges for iBeacons. 233 | * 234 | */ 235 | - (void)stopRangingIBeacons; 236 | 237 | /** setPartnerIdentifier 238 | * 239 | * Sets the partner identifer string for analytics. 240 | * 241 | * Limited to 255 characters. 242 | * 243 | */ 244 | - (void)setPartnerIdentifier:(NSString *)identifier; 245 | 246 | /** setAirship 247 | * 248 | * Sets the shared instance of Urban Airship SDK instance. 249 | * 250 | * Param: `airship` the instance of UAirship manager 251 | * 252 | *
253 |  *   [pkManager setAirship: [UAirship shared]];
254 |  * 
255 | * 256 | */ 257 | - (void)setAirship:(/* UAirship */id)airship; 258 | 259 | @end 260 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKManagerDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProximityKit 3 | // 4 | // Copyright (c) 2013 Radius Networks. All rights reserved. 5 | // 6 | 7 | #import 8 | #import 9 | 10 | typedef NS_ENUM (NSInteger, RPKRegionType) { 11 | RPKCircleType, 12 | RPKIBeaconType, 13 | }; 14 | 15 | typedef NS_ENUM (NSInteger, RPKRegionState) { 16 | RPKRegionStateUnknown, 17 | RPKRegionStateInside, 18 | RPKRegionStateOutside 19 | }; 20 | 21 | @class RPKManager; 22 | @class RPKRegion; 23 | @class RPKBeaconRegion; 24 | 25 | /*! 26 | @protocol RPKManagerDelegate 27 | @discussion 28 | The base delegate for Proximity Kit callbacks. 29 | 30 | This includes both callbacks that return the RPK custom classes and 31 | will proxy all the raw CoreLocation callbacks. 32 | */ 33 | @protocol RPKManagerDelegate 34 | @required 35 | @optional 36 | 37 | /*! 38 | @method proximityKitDidSync 39 | 40 | @discussion 41 | Invoked when kit has synced with the server and data is loaded and avaliable. 42 | 43 | */ 44 | - (void)proximityKitDidSync:(RPKManager *)manager; 45 | 46 | /*! 47 | @method proximityKit:didEnter: 48 | 49 | @discussion 50 | Invoked when new entering new region. Regions can be Geofences or iBeacons. 51 | 52 | */ 53 | - (void)proximityKit:(RPKManager *)manager 54 | didEnter:(RPKRegion *)region; 55 | 56 | /*! 57 | @method proximityKit:didExit: 58 | 59 | @discussion 60 | Invoked when new leaving a region. Regions can be Geofences or iBeacons. 61 | 62 | @param manager 63 | Instance of the RPKManager 64 | @param region 65 | The region exited 66 | 67 | */ 68 | - (void)proximityKit:(RPKManager *)manager 69 | didExit:(RPKRegion *)region; 70 | 71 | /*! 72 | @method proximityKit:didDetermineState:forRegion: 73 | 74 | @discussion 75 | Invoked when new changing state for a region. 76 | 77 | */ 78 | - (void)proximityKit:(RPKManager *)manager 79 | didDetermineState:(RPKRegionState)state 80 | forRegion:(RPKRegion *)region; 81 | 82 | /*! 83 | @method proximityKit:didRangeBeacons:inRegion 84 | 85 | @discussion 86 | Invoked when a new set of beacons are available in the specified region. 87 | 88 | Beacons is an array of RPKBeacon objects. 89 | 90 | If beacons is empty, it may be assumed no beacons that match the specified region are nearby. 91 | Similarly if a specific beacon no longer appears in beacons, it may be assumed the beacon is no longer received 92 | by the device. 93 | 94 | */ 95 | - (void)proximityKit:(RPKManager *)manager 96 | didRangeBeacons:(NSArray *)beacons 97 | inRegion:(RPKBeaconRegion *)region; 98 | 99 | /*! 100 | @method proximityKit:didFailWithError: 101 | 102 | @discussion 103 | Invoked when an error has occurred. 104 | */ 105 | - (void)proximityKit:(RPKManager *)manager 106 | didFailWithError:(NSError *)error; 107 | @end 108 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKMap.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | 5 | @interface RPKMap : NSObject { 6 | NSMutableArray *_overlays; 7 | } 8 | 9 | - (NSArray *)overlays; 10 | - (id)initWith:(NSDictionary *)dict; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Headers/RPKRegion.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Radius Networks. All rights reserved. 2 | 3 | #import 4 | 5 | @interface RPKRegion : NSObject { 6 | @protected 7 | NSString *_name; 8 | NSString *_identifier; 9 | NSDictionary *_attributes; 10 | } 11 | 12 | @property (readonly) NSString *name; 13 | @property (readonly) NSString *identifier; 14 | @property (readonly) NSDictionary *attributes; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/ios/ProximityKit.framework/Info.plist -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module ProximityKit { 2 | umbrella header "ProximityKit.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/ProximityKit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/ios/ProximityKit.framework/ProximityKit -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/_CodeSignature/CodeDirectory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/ios/ProximityKit.framework/_CodeSignature/CodeDirectory -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/_CodeSignature/CodeRequirements: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/ios/ProximityKit.framework/_CodeSignature/CodeRequirements -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Headers/ProximityKit.h 8 | 9 | s482bu3VorzUBjjgEGB0eeyPxNU= 10 | 11 | Headers/RPKAnalyticsEvent.h 12 | 13 | i5uylpvuXDv1nNTgqzrYf7TLAVw= 14 | 15 | Headers/RPKBeacon.h 16 | 17 | /TkgH9VaQJGA3MN6JuidSAwL18A= 18 | 19 | Headers/RPKBeaconRegion.h 20 | 21 | o+TOuk7DXsEkactik/rBGe4Z/e4= 22 | 23 | Headers/RPKCircle.h 24 | 25 | Yx+CW7vR6RLlVv/Yylz/dGgB3AM= 26 | 27 | Headers/RPKKit.h 28 | 29 | Xpvn231JQpEemoZpg1273NzlJ8s= 30 | 31 | Headers/RPKLogger.h 32 | 33 | ev4wqPW0DfvmanEaMkVEru+tC7M= 34 | 35 | Headers/RPKManager.h 36 | 37 | bB419RdqzDsj1IBRjV+6ivESQbY= 38 | 39 | Headers/RPKManagerDelegate.h 40 | 41 | t4p9S4hBTW/MaHwMMSN/aCHkIeY= 42 | 43 | Headers/RPKMap.h 44 | 45 | AiQmCdDlHi3TBbwqszT5H2nR9II= 46 | 47 | Headers/RPKRegion.h 48 | 49 | Igcrv+8diJJMiTcyzKcJt/WBdHw= 50 | 51 | Info.plist 52 | 53 | 28NMfwj8qNExdpNYiQpEW80vNPM= 54 | 55 | Modules/module.modulemap 56 | 57 | QEXKhVpsHZxA8Fb08ZmjBK3rHcc= 58 | 59 | 60 | files2 61 | 62 | Headers/ProximityKit.h 63 | 64 | s482bu3VorzUBjjgEGB0eeyPxNU= 65 | 66 | Headers/RPKAnalyticsEvent.h 67 | 68 | i5uylpvuXDv1nNTgqzrYf7TLAVw= 69 | 70 | Headers/RPKBeacon.h 71 | 72 | /TkgH9VaQJGA3MN6JuidSAwL18A= 73 | 74 | Headers/RPKBeaconRegion.h 75 | 76 | o+TOuk7DXsEkactik/rBGe4Z/e4= 77 | 78 | Headers/RPKCircle.h 79 | 80 | Yx+CW7vR6RLlVv/Yylz/dGgB3AM= 81 | 82 | Headers/RPKKit.h 83 | 84 | Xpvn231JQpEemoZpg1273NzlJ8s= 85 | 86 | Headers/RPKLogger.h 87 | 88 | ev4wqPW0DfvmanEaMkVEru+tC7M= 89 | 90 | Headers/RPKManager.h 91 | 92 | bB419RdqzDsj1IBRjV+6ivESQbY= 93 | 94 | Headers/RPKManagerDelegate.h 95 | 96 | t4p9S4hBTW/MaHwMMSN/aCHkIeY= 97 | 98 | Headers/RPKMap.h 99 | 100 | AiQmCdDlHi3TBbwqszT5H2nR9II= 101 | 102 | Headers/RPKRegion.h 103 | 104 | Igcrv+8diJJMiTcyzKcJt/WBdHw= 105 | 106 | Modules/module.modulemap 107 | 108 | QEXKhVpsHZxA8Fb08ZmjBK3rHcc= 109 | 110 | 111 | rules 112 | 113 | ^ 114 | 115 | ^.*\.lproj/ 116 | 117 | optional 118 | 119 | weight 120 | 1000 121 | 122 | ^.*\.lproj/locversion.plist$ 123 | 124 | omit 125 | 126 | weight 127 | 1100 128 | 129 | ^version.plist$ 130 | 131 | 132 | rules2 133 | 134 | .*\.dSYM($|/) 135 | 136 | weight 137 | 11 138 | 139 | ^ 140 | 141 | weight 142 | 20 143 | 144 | ^(.*/)?\.DS_Store$ 145 | 146 | omit 147 | 148 | weight 149 | 2000 150 | 151 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 152 | 153 | nested 154 | 155 | weight 156 | 10 157 | 158 | ^.* 159 | 160 | ^.*\.lproj/ 161 | 162 | optional 163 | 164 | weight 165 | 1000 166 | 167 | ^.*\.lproj/locversion.plist$ 168 | 169 | omit 170 | 171 | weight 172 | 1100 173 | 174 | ^Info\.plist$ 175 | 176 | omit 177 | 178 | weight 179 | 20 180 | 181 | ^PkgInfo$ 182 | 183 | omit 184 | 185 | weight 186 | 20 187 | 188 | ^[^/]+$ 189 | 190 | nested 191 | 192 | weight 193 | 10 194 | 195 | ^embedded\.provisionprofile$ 196 | 197 | weight 198 | 20 199 | 200 | ^version\.plist$ 201 | 202 | weight 203 | 20 204 | 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /src/ios/ProximityKit.framework/_CodeSignature/CodeSignature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RadiusNetworks/proximitykit-plugin-cordova/d236f105b1e6966b9332e73dcfccc49506e6cd56/src/ios/ProximityKit.framework/_CodeSignature/CodeSignature -------------------------------------------------------------------------------- /src/ios/RPKCDVPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface RPKCDVPlugin : CDVPlugin 5 | 6 | - (void)watchProximity:(CDVInvokedUrlCommand *)command; 7 | - (void)clearWatch:(CDVInvokedUrlCommand *)command; 8 | 9 | @end 10 | 11 | -------------------------------------------------------------------------------- /src/ios/RPKCDVPlugin.m: -------------------------------------------------------------------------------- 1 | #import "RPKCDVPlugin.h" 2 | 3 | NSString * const RPKCDVEventTypeKey = @"eventType"; 4 | NSString * const RPKCDVEventTypeSynced = @"didSync"; 5 | NSString * const RPKCDVEventTypeEnteredRegion = @"didEnterRegion"; 6 | NSString * const RPKCDVEventTypeExitedRegion = @"didExitRegion"; 7 | NSString * const RPKCDVEventTypeDeterminedRegionState = @"didDetermineState"; 8 | NSString * const RPKCDVEventTypeRangedBeacon = @"didRangeBeacon"; 9 | 10 | NSString * const RPKCDVEventRegionKey = @"region"; 11 | NSString * const RPKCDVEventRegionNameKey = @"name"; 12 | NSString * const RPKCDVEventRegionIdentifierKey = @"identifier"; 13 | NSString * const RPKCDVEventRegionAttributesKey = @"attributes"; 14 | NSString * const RPKCDVEventRegionStateKey = @"state"; 15 | 16 | NSString * const RPKCDVEventBeaconKey = @"beacon"; 17 | 18 | NSString * const RPKCDVEventBeaconUUIDKey = @"uuid"; 19 | NSString * const RPKCDVEventBeaconMajorKey = @"major"; 20 | NSString * const RPKCDVEventBeaconMinorKey = @"minor"; 21 | NSString * const RPKCDVEventBeaconRSSIKey = @"rssi"; 22 | NSString * const RPKCDVEventBeaconProximityKey = @"proximity"; 23 | NSString * const RPKCDVEventBeaconAttributesKey = @"attributes"; 24 | 25 | @interface RPKRegion (RPKAdditions) 26 | 27 | -(NSDictionary *) toDictionary; 28 | 29 | @end 30 | 31 | @implementation RPKRegion (RPKAdditions) 32 | 33 | -(NSDictionary *) toDictionary 34 | { 35 | return @{ 36 | RPKCDVEventRegionNameKey: self.name, 37 | RPKCDVEventRegionIdentifierKey: self.identifier, 38 | RPKCDVEventRegionAttributesKey: self.attributes, 39 | }; 40 | } 41 | 42 | @end 43 | 44 | @interface RPKBeacon (RPKAdditions) 45 | 46 | -(NSDictionary *) toDictionary; 47 | 48 | @end 49 | 50 | @implementation RPKBeacon (RPKAdditions) 51 | 52 | -(NSDictionary *) toDictionary 53 | { 54 | return @{ 55 | RPKCDVEventBeaconUUIDKey: [self.uuid UUIDString], 56 | RPKCDVEventBeaconMajorKey: self.major, 57 | RPKCDVEventBeaconMinorKey: self.minor, 58 | RPKCDVEventBeaconRSSIKey: self.rssi, 59 | RPKCDVEventBeaconProximityKey: @(self.proximity), 60 | RPKCDVEventBeaconAttributesKey: self.attributes 61 | }; 62 | } 63 | 64 | @end 65 | 66 | 67 | @interface RPKCDVPlugin () 68 | 69 | @property (strong, nonatomic) RPKManager *proximityKitManager; 70 | @property (strong, nonatomic) NSMutableDictionary* watchCallbacks; 71 | 72 | @end 73 | 74 | @implementation RPKCDVPlugin 75 | 76 | - (void)pluginInitialize 77 | { 78 | self.proximityKitManager = [RPKManager managerWithDelegate:self]; 79 | [self.proximityKitManager start]; 80 | self.watchCallbacks = [[NSMutableDictionary alloc] init]; 81 | } 82 | 83 | - (void)dealloc 84 | { 85 | NSLog(@"Stopping RPKManager"); 86 | self.proximityKitManager.delegate = nil; 87 | [self.proximityKitManager stop]; 88 | self.proximityKitManager = nil; 89 | } 90 | 91 | - (void)watchProximity:(CDVInvokedUrlCommand*)command 92 | { 93 | [self.watchCallbacks setObject:command.callbackId forKey:command.arguments[0]]; 94 | } 95 | 96 | - (void)clearWatch:(CDVInvokedUrlCommand*)command; 97 | { 98 | [self.watchCallbacks removeObjectForKey:command.arguments[0]]; 99 | } 100 | 101 | - (void)onReset 102 | { 103 | } 104 | 105 | #pragma mark - 106 | #pragma mark ProximityKit delegate methods 107 | 108 | - (void)proximityKitDidSync:(RPKManager *)manager 109 | { 110 | NSLog(@"didSync"); 111 | [self sendSuccessMessageToAllWatches:[self pluginResultDidSync]]; 112 | } 113 | 114 | - (void)proximityKit:(RPKManager *)manager didFailWithError:(NSError *)error 115 | { 116 | NSLog(@"didFailWithError %@", error); 117 | for (NSString *callbackId in self.watchCallbacks.allValues) 118 | { 119 | CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[error localizedDescription]]; 120 | [result setKeepCallbackAsBool:YES]; 121 | [self.commandDelegate sendPluginResult:result callbackId:callbackId]; 122 | } 123 | } 124 | 125 | - (void)proximityKit:(RPKManager *)manager didEnter:(RPKRegion *)region { 126 | NSLog(@"didEnter %@", region); 127 | [self sendSuccessMessageToAllWatches:[self pluginResultDidEnter:region]]; 128 | } 129 | 130 | - (void)proximityKit:(RPKManager *)manager didExit:(RPKRegion *)region { 131 | NSLog(@"didExit %@", region); 132 | [self sendSuccessMessageToAllWatches:[self pluginResultDidExit:region]]; 133 | } 134 | 135 | - (void)proximityKit:(RPKManager *)manager didDetermineState:(RPKRegionState)state 136 | forRegion:(RPKRegion *)region 137 | { 138 | NSLog(@"didDetermineState %@", region); 139 | [self sendSuccessMessageToAllWatches:[self pluginResultDidDetermineState:state forRegion:region]]; 140 | } 141 | 142 | - (void)proximityKit:(RPKManager *)manager didRangeBeacons:(NSArray *)beacons 143 | inRegion:(RPKRegion *)region 144 | { 145 | NSLog(@"didRangeBeacons %@", beacons); 146 | // Callback for each individual beacon, not all at once, because Android receives only one at a time. 147 | for (RPKBeacon *beacon in beacons) 148 | { 149 | CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self pluginResultDidRangeBeacon:beacon]]; 150 | [result setKeepCallbackAsBool:YES]; 151 | for (NSString *callbackId in self.watchCallbacks.allValues) 152 | { 153 | [self.commandDelegate sendPluginResult:result callbackId:callbackId]; 154 | } 155 | } 156 | } 157 | 158 | #pragma mark - Plugin Results 159 | 160 | -(void) sendSuccessMessageToAllWatches:(NSDictionary *) message 161 | { 162 | for (NSString *callbackId in self.watchCallbacks.allValues) 163 | { 164 | CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message]; 165 | [result setKeepCallbackAsBool:YES]; 166 | [self.commandDelegate sendPluginResult:result callbackId:callbackId]; 167 | } 168 | } 169 | 170 | -(NSDictionary *) pluginResultDidSync 171 | { 172 | return @{RPKCDVEventTypeKey : RPKCDVEventTypeSynced}; 173 | } 174 | 175 | -(NSDictionary *) pluginResultDidDetermineState:(RPKRegionState) state forRegion:(RPKRegion *) region 176 | { 177 | return @{ 178 | RPKCDVEventTypeKey : RPKCDVEventTypeDeterminedRegionState, 179 | RPKCDVEventRegionStateKey : @(state), 180 | RPKCDVEventRegionKey : [region toDictionary] 181 | }; 182 | } 183 | 184 | 185 | -(NSDictionary *) pluginResultDidEnter:(RPKRegion *) region 186 | { 187 | return @{ 188 | RPKCDVEventTypeKey : RPKCDVEventTypeEnteredRegion, 189 | RPKCDVEventRegionKey : [region toDictionary] 190 | }; 191 | } 192 | 193 | -(NSDictionary *) pluginResultDidExit:(RPKRegion *) region 194 | { 195 | return @{ 196 | RPKCDVEventTypeKey : RPKCDVEventTypeExitedRegion, 197 | RPKCDVEventRegionKey : [region toDictionary] 198 | }; 199 | } 200 | 201 | -(NSDictionary *) pluginResultDidRangeBeacon:(RPKBeacon *) beacon 202 | { 203 | return @{ 204 | RPKCDVEventTypeKey : RPKCDVEventTypeRangedBeacon, 205 | RPKCDVEventBeaconKey : [beacon toDictionary] 206 | }; 207 | } 208 | 209 | @end 210 | -------------------------------------------------------------------------------- /www/proximitykit.js: -------------------------------------------------------------------------------- 1 | var exec = require('cordova/exec'), 2 | utils = require('cordova/utils'); 3 | 4 | var pluginClass = "ProximityKit"; 5 | 6 | var proximitykit = 7 | { 8 | constants: { 9 | 'keys' : { 10 | 'eventType' : 'eventType', 11 | 'region' : 'region', 12 | 'state' : 'state', 13 | 'name' : 'name', 14 | 'identifier' : 'identifier', 15 | 'attributes' : 'attributes', 16 | 'uuid' : 'uuid', 17 | 'major' : 'major', 18 | 'minor' : 'minor', 19 | 'rssi' : 'rssi', 20 | 'proximity' : 'proximity', 21 | 'beacon' : 'beacon' 22 | }, 23 | 'eventTypes' : { 24 | 'sync' : 'didSync', 25 | 'determinedRegionState' : 'didDetermineState', 26 | 'enteredRegion' : 'didEnterRegion', 27 | 'exitedRegion' : 'didExitRegion', 28 | 'rangedBeacon' : 'didRangeBeacon' 29 | } 30 | }, 31 | 32 | watchProximity: function(success, error) { 33 | var watchId = utils.createUUID(); 34 | exec(success, error, pluginClass, "watchProximity", [watchId]); 35 | return watchId; 36 | }, 37 | 38 | clearWatch: function(watchId) { 39 | exec(null, null, pluginClass, "clearWatch", [watchId]); 40 | } 41 | }; 42 | 43 | module.exports = proximitykit; 44 | 45 | --------------------------------------------------------------------------------