What is the best way to get user geolocation before rendering a template


#1

Hi, I am having a lot of trouble on iOS and Android with a Google Map I added to my Meteor app, and I think that the main problem is the way I am getting the geolocation right now which is by using this:

 Tracker.autorun(function () {
    var geo = Geolocation.latLng();
    Session.set('geo', geo);
  });

and the mdg:geolocation pacakge (https://atmospherejs.com/mdg/geolocation) I would like to know what do you think would be the best way to get the current user location, maybe a waitOn on the route? Or how can I make a function to wait for the Session before Meteor renders the template? Thanks in advance!


#2

Did you add org.apache.cordova.geolocation?


#3

The mdg:geolocation package adds it

Cordova.depends({
  "org.apache.cordova.geolocation": "0.3.10"
});

what i would like is to display a loading template while Geolocation.latLng(); is getting the position from the device GPS, do you know how could I do this? :s thanks in advance!


#4

Hey cosio55,

Were you able to figure out the issue. I am having the same problem in one of my apps.

Thanks