ngCordova Geolocation Fails


#1

Hi All,

I’m simply trying to fetch current position of my device but $cordovaGeolocation service just does not work. I’m not doing anything special. When promise returns it only logs something like “:60” without any error. I took a look at other code examples and my code is not different. Does anyone have an idea what might be the problem?

BTW my code is in a directive.

        scope.getPosition=function(){
                var options = {
                    enableHighAccuracy: true,
                    timeout: 20000,
                    maximumAge: 0
                };
                $cordovaGeolocation.getCurrentPosition(options).then(function(position){
                    console.log(position.coords.latitude,position.coords.longitude);
                },function(err){
                    console.log(err);
                });

        };

#2

Did you added the Geolocation plugin into your cordova build?