friends with this code center the map and geolocalize, in the browser everything works ok, but at the general the .apk only focuses me the map does not geolocate me even having the gps activated
.controller('MapCtrl', function($scope, $ionicLoading, $ionicPopup) {
var zocalo = { lat: 11.0041072, lng: -74.80698129999996 }
var miubicacion = {}
initMap = function() {
var mapDiv = document.getElementById('map');
var mapOptions = {
center: zocalo,
zoom: 16
}
$scope.map = new google.maps.Map(mapDiv, mapOptions)
$scope.locateme();
}
$scope.locateme = function() {
$ionicLoading.show({});
navigator.geolocation.getCurrentPosition(function(pos) {
miubicacion.lat = pos.coords.latitude;
miubicacion.lng = pos.coords.longitude;
$scope.map.setCenter(miubicacion);
$ionicLoading.hide();
addMarker();
},
function(error) {
$ionicLoading.hide();
console.log("errror");
})
}
addMarker = function() {
var marker = new google.maps.Marker({
map: $scope.map,
position: miubicacion,
title: 'aqui estas ubicado',
animation: google.maps.Animation.DROP
})
}
if (document.readyState == "complete") {
initMap()
} else {
google.maps.event.addDomListener(window, 'load', initMap);
}
})