Skip to content

Instantly share code, notes, and snippets.

View Kevinwlee's full-sized avatar

Kevin Lee Kevinwlee

View GitHub Profile
@Kevinwlee
Kevinwlee / geofence-params.mm
Last active August 29, 2015 14:03
Geofence parameters
CLLLocationDegrees lat = -29.7635349f;
CLLLocationDegrees lng = -95.4619215f;
CCLLocationCoordinate2D center = CLLLocationCoordinate2DMake(lat, lng);
CLLLocationDistance radius = 20.0f; // in meters
@Kevinwlee
Kevinwlee / create-geofence.mm
Last active August 29, 2015 14:03
Create geofence
[[CCHGeofenceService sharedInstance] createGeofenceWithCenter:center radius:radius name:@"Geofence" tags:@"demo" completionHandler:^(NSDictionary *geofence, NSError *error) {
}];
@Kevinwlee
Kevinwlee / get-geofence.mm
Last active August 29, 2015 14:03
Get a geofence
[[CCHGeofenceService sharedInstance] getGeofenceWithId:@"100" completionHandler:^(NSDictionary *geofence, NSError *error) {
// geofence dictionary has info about geofence created
}];
@Kevinwlee
Kevinwlee / get-geofences.mm
Last active August 29, 2015 14:03
Get geofences with tags
[[CCHGeofenceService sharedInstance] getGeofencesWithTag:@"demo" location:location radius:radius completionHandler:(NSArray *geofences, NSError *error) {
// access first geofence like so: geofences[0]
}];
@Kevinwlee
Kevinwlee / update-geofence.mm
Last active August 29, 2015 14:03
Update geofence
[[CCHGeofenceService sharedService] updateGeofence:geofence completionHandler:(NSError *error) {}];
@Kevinwlee
Kevinwlee / delete-geofence.mm
Last active August 29, 2015 14:03
Deleting a geofence
[[CCHGeofenceService sharedService] deleteGeofence:geofence completionHandler:(NSError *error) {}];
@Kevinwlee
Kevinwlee / add-subscription.mm
Last active August 29, 2015 14:03
Add a subscription
[[CCHSensorPipeline sharedInstance] addSubscriptionForTags:@[@"demo"]];
@Kevinwlee
Kevinwlee / add-observer.mm
Last active August 29, 2015 14:03
Observing sensor pipeline events
[[NSNotificationCenter defaultCenter] addObserver: self selector:@selector("your-method-here") name: CCHSensorPipelineDidPostEvent object:nil];
@Kevinwlee
Kevinwlee / notification-object.mm
Last active August 29, 2015 14:03
Sample handler
- (void)handleNotification:(NSNotification *)notification {
NSDictionary *event = notification.object;
// handle event notification here
}
@Kevinwlee
Kevinwlee / add-geofence-subscription.mm
Last active August 29, 2015 14:03
Adding a geofence subscription
[[CCHSubscriptionService sharedInstance] addGeofenceSubscriptionForTags:@[@"demo"] completionHandler:^(NSError *error){}];