Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49258

$cordovaGeolocation Always Timing Out ! Any alternative?

$
0
0

@Sumeet123 wrote:

No matter what the timeout is set or whether the high accuracy is true or false !!
$cordovageolocation always returning error code 3 error message Timeout expired

Heres my code :-

$ionicPlatform.ready(function() {

          var posOptions = {
             enableHighAccuracy: false,
             timeout: 30000,
             maximumAge: 0
         };

   $cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
       var lat  = position.coords.latitude;
       var long = position.coords.longitude;

       //alert(lat);
       var FormData = {
         'radius' : $localStorage.nearradius,
         'latitude' : lat,
         'longitude' : long
       };
       $http({
         method: 'POST',
         url: 'http://xyz.com/abc',
         data: FormData,
         headers: {'Content-Type': 'application/x-www-form-urlencoded','Authorization':undefined},
       })
       .success(function(data) {

           defer.resolve(data);
       })
       .error(function(data) {
   });



   }, function(err) {

       alert(err.code+" "+err.message);
   });

It always goes in function(err) ....

Code is wrapped inside ionic platform ready !

Help is appreciated !!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49258

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>