Default example for Android Geolocation fails - this is bad

Hi there, still struggling with Android geolocation and the problem seems to be more serious than I thought because it comes up with the standard example.

I start from the empty blank project, add the cordova geolocation plugin, add few lines of code. Yet it fails with a timeout on a physical Android phone (6.0). Can it really be that the plugin is not supported for Droid > 5.1 as stated on the repo page?

ionic start geoTest blank --v2

ionic platform add android
ionic plugin add cordova-plugin-geolocation

open ./src/app/app.component.ts

Adding :

import { StatusBar, Splashscreen,Geolocation } from 'ionic-native';

platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      Geolocation.getCurrentPosition({ maximumAge: 60000, timeout: 30000, enableHighAccuracy: true }).then((position) => {
      }, (error) => {

Keeps giving me timeouts / error 3.

Android manifest file contains

1 Like

have you tried running it in actual physical device?
there maybe an issue with running geolocation in emulators

Yes, real phone. Simulator fails too. iOS and browser run smooth.

this is how im doing it, and its working on my side: (K,L,M&N android versions)
Geolocation.getCurrentPosition().then((position) => { = position.coords.latitude;
		this.lng = position.coords.longitude;
		this.pos_details = JSON.stringify(position);
		console.log('Position retrieved:'' '+this.lng);

	    }, (err) => {

Try to restart you phone and removing the app first.
Also, try removing the options and see if something changes, that might help

1 Like

Dude, I owe you one. I believe that the manifest file was not over written and hence the app didnt have the ability to geolocate. Delete app, reboot, restart worked. Yet, this should be mentioned somewhere as a known quirk.

1 Like

Could you be more explicit ?