Having trouble using ngCordova $cordovaGeolocation

I’m having trouble using the $cordovaGeolocation. It works on the browser but when I build for android, I can’t make it work. These are my codes.

app.js

angular.module('ionic.sample', ['ionic','ngCordova'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

 .controller('MapCtrl', function($scope, $cordovaGeolocation) {

function initialize() {
  
    var posOptions = {timeout: 10000, enableHighAccuracy: false};
    
    $cordovaGeolocation
        .getCurrentPosition(posOptions)
        .then(function (position) {
      var lat  = position.coords.latitude,
      lng = position.coords.longitude,
          myLoc = new google.maps.LatLng(lat, lng);
 
  var mapOptions = {
    streetViewControl:true,
    zoom: 12,
    center: myLoc,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };

var mapD = new google.maps.Map(document.getElementById('map'),
      mapOptions);

    var marker = new google.maps.Marker({
      position: myLoc,
      map: mapD,
      title: 'Hello World!'
  });
    });
   
}
    google.maps.event.addDomListener(window, 'load', initialize);
});

In my case, you have to set “enableHighAccuracy” to true to make it work, it is an unfixed bug on Android. Currently android <4.4 only support Internet Positioning instead of GPS according to my experience. Hope this helps.

Thanks for the reply. I have set it to true but it doesn’t work either. Do you have any solution or other plugins that works?

Hello did you install

cordova plugin add org.apache.cordova.geolocation

and add in the index the ng-cordova.min.js with this two things i can get the coordinates if the gps is on.