Premium HTTP and Persistence Layers Posted on 14 May 17:08 , 0 comments

The Premium version now has native HTTP and SQLite persistence layers for both iOS and Android.  The plugin will persist each received location to SQLite providing the ability to sync the recorded locations to your server when a network connection is present.

The following new parameters now exist in support of these features:

@config {Boolean} #autoSync [true]
set to true to automatically POST each recorded geolocation to your configured #url.  When set to false, the Javascript API provides a #sync method allowing you to manually sync the recorded locations.

 

@config {Boolean} batchSync [false]

Set to true to combine all recorded locations into a single HTTP request.  When set to false, the plugin will initiate an HTTP POST for each recorded geolocation (REST-style).

In addition, two new Javascript methods:

#getLocations(successFn, failureFn)
bgGeo.getLocations(function(locations) {
   console.log('Locations: ', locations);
}, function(errorMsg) {
    console.warn('Failed to get locations: ', errorMsg);
});
#sync(successFn, failureFn)
bgGeo.sync(function(locations) {
   console.log('Locations: ', locations);
}, function(errorMsg) {
    console.warn('Failed to get sync: ', errorMsg);
});