GEO user location and path


#1

Hello guys!
I was playing around with the maps but I see there is geolocation set in the script but there is no way for me to get the user location to display a path

can you guys help?

        navigator.geolocation.getCurrentPosition(function(pos) {
      $scope.map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
      $scope.loading.hide();
    }, function(error) {
      alert('Unable to get location: ' + error.message);
    });

#2

ok no respond for over 10 days now, please help?


#3

I’m not sure i understand the problem. In your example, do you actually get the pos ? If not, are you waiting for device ready event.

Try wrapping this in Platform to see if you get a response then.

Platform.ready(function() {

	navigator.geolocation.getCurrentPosition(function(pos) {
		$scope.map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
		$scope.loading.hide();
	}, function(error) {
		alert('Unable to get location: ' + error.message);
	});

});

#4

didn’t work, all I want is to be able to locate the user location


#5

Can you give us a bit more information? Maybe tell us an error you are getting? Perhaps throw a few console.log statements inside the code I showed you to spit out some debug info?


#6

yeah I am not getting any responds or error to show off the maps works fine but no errors.