Geolocation not working on Android


#1

Hello

I have this code in the .ts:

lat: any;
lng: any;

  constructor(public navCtrl: NavController, navParams: NavParams, private callNumber: CallNumber,
    private geolocation: Geolocation) {
  }

  ionViewDidLoad() {
    this.geolocation.getCurrentPosition().then( pos => {
      this.lat = pos.coords.latitude;
      this.lng = pos.coords.longitude;
    }).catch( err => console.log(err));
  }

And the Geolocation is imported also in this .ts and app-module and declared on providers.
Also the lat and lng is set to be shown in the html.

It’s working perfectly in the web version giving me the lat and lng, but in Android there is nothing showing.

I’ve searched in the internet and nothing worked for me. Any ideas on whats going on?


#2

Hi some help please?