Geolocation.getCurrentPosition not working in ANDROID device

geolocation.getCurrentPosition not working in ANDROID device, but when using in browser it’s working fine

What else i have to do…

This is my controller
.controller(‘MapController’, function($scope, $ionicLoading,$http,$ionicPopup) {

google.maps.event.addDomListener(window, 'load', function() {
    var myLatlng = new google.maps.LatLng(37.3000, -120.4833);

    var mapOptions = {
        center: myLatlng,
        zoom: 16,
        mapTypeId: google.maps.MapTypeId.ROADMAP

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

    navigator.geolocation.getCurrentPosition(function(pos) {
        map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
        var myLocation = new google.maps.Marker({
            position: new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude),
            map: map,
            title: "My Location"

       var lat_long = pos.coords.latitude+","+pos.coords.longitude;
       var link = "[MY API KEY]/"+lat_long;

        $http.get(link, {}).then(function (res){
          var farenheit_temp =;
          var celcius_temp = (farenheit_temp - 30) / 2;
           var alertPopup = $ionicPopup.alert({
                  title: 'Details',
                  template: "<p>Temperature:- "+celcius_temp.toFixed(2)+" c<br/>""<br/>Humidity:- ""<br>Wind Speed:- ""</p>",

    },function(){},{maximumAge:60000, timeout:2000, enableHighAccuracy:true});

    $ = map;


Not all android support navigator, so I use to this purpose plugin Because it allow me get user’s position from google play services.

will it work for IOS too

In iOS you should use navigator, becuase it work good in all iPhone which I tested ex. iPhone 4 and 6 and probable iPhone 5. On iPad 2 work good, too.

Does it work with android 6? It tried but no success.