title: cordova-plugin-geolocation not working on Android device
body: <p>I've implemented the cordova-plugin-geolocation plugin in my ionic/cordova app. It works perfectly when I run the app in my browser as well as on an iOS device. However when I try and run it on an Android device the map doesn't get displayed and it doesn't get your current GPS co-ordinates. After it times out it throws the following error:</p>
  
  <blockquote>
    <p>[object PositionError]</p>
  </blockquote>
  
  <p>First I added the plugin (as well as the cordova-plugin-whitelist plugin by running this is the cli:</p>
  
  <pre><code>cordova plugin add cordova-plugin-geolocation
  cordova plugin add cordova-plugin-whitelist
  </code></pre>
  
  <p>I then added the following to my index.html:</p>
  
  <pre><code>&lt;script src="//maps.googleapis.com/maps/api/js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular-google-maps/dist/angular-google-maps.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I then modified my app.js to include 'uiGmapgoogle-maps':</p>
  
  <pre><code>var app = angular.module('myApp', ['ionic', 'ngCordova', 'uiGmapgoogle-maps']);
  </code></pre>
  
  <p>My HTML for the map:</p>
  
  <pre><code> &lt;!-- Google map --&gt;
      &lt;ui-gmap-google-map center='map.center' zoom='map.zoom'&gt;
        &lt;ui-gmap-marker coords="marker.coords" options="marker.options" events="marker.events" idkey="marker.id" closeClick="hideMarkerPopup()" onClicked="showMarkerPopup()"&gt;&lt;/ui-gmap-marker&gt;
      &lt;/ui-gmap-google-map&gt;
  </code></pre>
  
  <p>And finally the logic in my controller:</p>
  
  <pre><code>ionic.Platform.ready(function() {
  
              var posOptions = {
                  enableHighAccuracy: true,
                  timeout: 20000,
                  maximumAge: 0
              };
  
              // Display 'loading' dialog
              $ionicLoading.show({
                  template: 'Loading...'
              });
  
              $cordovaGeolocation.getCurrentPosition(posOptions).then(function(position) {
  
                  // Apply new values to map
                  $scope.location = {};
                  $scope.location.lat = position.coords.latitude;
                  $scope.location.long = position.coords.longitude;
                  $scope.map = {
                      center: {
                          latitude: $scope.location.lat,
                          longitude: $scope.location.long
                      },
                      zoom: 16,
                      pan: 1
                  };
  
                  $scope.marker = {
                      id: 0,
                      coords: {
                          latitude: $scope.location.lat,
                          longitude: $scope.location.long
                      }
                  };
  
                  $scope.marker.options = {
                      draggable: false
                  };
  
                  // Dismiss 'loading' dialog
                  $ionicLoading.hide();
  
              }, function(err) {
  
                  // Dismiss 'please wait' dialog
                  $ionicLoading.hide();
  
                  var alertPopup = $ionicPopup.alert({
                      title: 'GPS Error',
                      template: err
                  });
  
              });
  
          }); // ionic.Platform.ready END
  </code></pre>
  
  <p>But, as I said. It works in the browser and iOS devices but not on Android devices.. Any help?</p>