he instalado el plugin de corodova geolocation, podrian decirme ¿porque debido ese error?, lo intale como esta en esta pagina http://ngcordova.com/docs/plugins/geolocation/.
y solo puse:
$cordovaGeolocation
.getCurrentPosition(posOptions)
.then(function (position) {
var lat = position.coords.latitude
var long = position.coords.longitude
}, function(err) {
// error
});
en el Androidmanifest.xml tiene esta configuración:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-feature android:name="android.hardware.location.gps" />
y en config.xml
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
</feature>
controlador:
function controlfproductoG ($scope, $timeout, $http, $ionicPopup, $ionicLoading, productosDato, urlRoot, $ionicSlideBoxDelegate, $interpolate, $stateParams, $animate, historialPagina, $cordovaGeolocation){
existeLocalStorage();
var typeT, cardTypes, beneficiosT, beneficioLocal, countProductoId, productoSelecionado, productoSelecionadoB;
var posOptions = {timeout: 10000, enableHighAccuracy: false};
var countDato = 0;
var countSwith = 0;
var countSwithB = 1;
var countCards = 0;
var cateId = ($stateParams.categoria == '') ? 0 : $stateParams.categoria;
$scope.cards = [];
$cordovaGeolocation
.getCurrentPosition(posOptions)
.then(function (position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
console.log(lat + ', ' + long);
}, function (error) {
console.log(error)
})
}
Muchas gracias.
<uses-permission