Start a new topic

Caching queries with geoloc in angular

Hello,

I am using this code to find a list of missions near a location. I am specifying offline true to go to cache first, but the local queries fails (see error below) and kinvey always go online ... Any idea on how to fix this?



var query = new $kinvey.Query();

query = query.near("_geoloc", [coords.latitude, coords.longitude], radius);

return $kinvey.DataStore.find('missions', query, {offline:true});









ERRROR:

TypeError: Cannot read property 'length' of undefined

at f.priority (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:3:128)

at Object.k.testers.$trav [as e] (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:17:537)

at f.priority (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:3:178)

at Object.k.testers.$trav [as e] (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:17:537)

at f.priority (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:3:178)

at Object.q.priority (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:11:150)

at e (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:26:90)

at h (http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:28:75)

at http://localhost:5000/scripts/libs/angular/kinvey-angular/1.1.7/kinvey-angular.js?bust=v11396971591720:8112:37

at wrappedCallback (http://localhost:5000/scripts/libs/angular/1.2.9/angular.js?bust=v11396971591720:10950:81)

Local geolocation queries are unfortunately not supported, see the [limitations](http://devcenter.kinvey.com/guides/caching-offline#Limitations) section of our guides.
Didnt see that... Thanks



anyway to manually cache the result with kinvey after the first query?
There’s no easy way to do this through the library - I’d suggest using LocalStorage or something similar instead.
Login or Signup to post a comment