Commit 51857664 authored by Chris Scott's avatar Chris Scott

Refactor ios to be more intelligent with geolocation, turning on more...

Refactor ios to be more intelligent with geolocation, turning on more aggressive standard location services wehn user is detected to be moving beyond a configurable radius
parent d4d7571f
......@@ -12,17 +12,11 @@
- (void) start:(CDVInvokedUrlCommand*)command;
- (void) stop:(CDVInvokedUrlCommand*)command;
- (void) test:(CDVInvokedUrlCommand*)command;
- (void) finish:(CDVInvokedUrlCommand*)command;
- (void) sync;
- (void) onSuspend:(NSNotification *)notification;
- (void) onResume:(NSNotification *)notification;
@property(nonatomic,retain) NSString *token;
@property(nonatomic,retain) NSString *url;
@property(nonatomic,assign) BOOL enabled;
@property(nonatomic,retain) NSNumber *maxBackgroundHours;
@property (nonatomic, strong) CLLocationManager* locationManager;
@property (nonatomic, strong) CDVLocationData* locationData;
@property (strong) NSMutableArray *locationCache;
@property (nonatomic, retain) NSDate *suspendedAt;
@end
This diff is collapsed.
......@@ -28,11 +28,15 @@ module.exports = {
if (!config.auth_token || !config.url) {
console.log("BackgroundGeoLocation requires an auth_token and url to report to the server");
}
var stationaryRadius = config.stationaryRadius || 50, // meters
distanceFilter = config.distanceFilter || 500, // meters
locationTimeout = config.locationTimeout || 60; // seconds
exec(success || function() {},
failure || function() {},
'BackgroundGeoLocation',
'configure',
[config.auth_token, config.url]);
[config.auth_token, config.url, stationaryRadius, distanceFilter, locationTimeout]);
},
start: function(success, failure, config) {
exec(success || function() {},
......@@ -54,6 +58,14 @@ module.exports = {
'BackgroundGeoLocation',
'test',
[]);
},
finish: function(success, failure) {
exec(success || function() {},
failure || function() {},
'BackgroundGeoLocation',
'finish',
[]);
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment