Ionic and geolocation issue on Android device when Location is off

Hello Ionic 2 funs and developers,

I created an example application (similar to this) to test geolocation on android device.

Application work normally on firefox browser using ionic serve, but the problem appears when application is running on my android device (4.4) with ‘location’ option is off.

Geolocation part of the code looks like in the doc

let options = {timeout: 5000, enableHighAccuracy: true, maximumAge: 60000}; 
          (resp) => {
            console.log("Geolocation : " + resp.coords.latitude + ", " + resp.coords.longitude);
            // center on the location
          (error) => {

and when ‘location’ option is off I expect to obtain an error PositionError.TIMEOUT or PositionError.POSITION_UNAVAILABLE, however the onError callback is never executed on the device.

If somebody knows how to deal with the problem, please share your experience


So a few things…

getCurrentPosition returns a promise, not an observable, so the setup is a bit off

      .then((resp) => {
        console.log('Geolocation : ' + resp.coords.latitude + ', ' + resp.coords.longitude);
        // center on the location{ lat: resp.coords.latitude, lng: resp.coords.longitude });

can you try that?

Yes, it works as you said ! Thank you

1 Like

geolocation not working with Marshmallow android 6.0


Do you still have this issue?? damn Ioninc on Android phones!!!

I have the similar issue on Android Phone.

Can I resolve it?

I use this simple code

get_current_position() {
    this.geolocation.getCurrentPosition().then((position) => {


      // resp.coords.latitude
      // resp.coords.longitude
    }).catch((error) => {
      console.log('Error getting location', error);

  ionViewDidLoad() {
    console.log('ionViewDidLoad Trymap');

And the console shows nothing