android "Illegal Access" cordovaGeolocation

1

I have installed the corodova geolocation plugin, could you tell me why because of that error ?, what is intale like on this page link .

and I just put:

$cordovaGeolocation
 .getCurrentPosition(posOptions)
 .then(function (position) {
   var lat  = position.coords.latitude
   var long = position.coords.longitude
 }, function(err) {
   // error
 });

in the Androidmanifest.xml has this configuration:

<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" />

and in config.xml

<feature name="Geolocation">
  <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
</feature>

driver:

 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)
      })
 }

Thank you very much.

    
asked by Albert Arias 15.11.2016 в 19:00
source

1 answer

1

Install the plugin:

cordova plugin add cordova-plugin-geolocation

this may be caused by "Illegal Access"

    
answered by 15.11.2016 в 19:06