Geolocation not Works on Android!

Can some Ionic engineer or anyone else explain to me why a basic feature like Geo Location does not work on Android? This left me disappointed with Ionic to the point that I was considering throwing my entire project off a few days ago from the official release.

This is my code:

  getLocation() {
    return new Promise((resolve, reject) => {
      this.geolocation.getCurrentPosition({timeout: 10000, enableHighAccuracy: true}).then((resp) => {
       }).catch((error) => {
         // console.log('Error getting location', error);

What is going on

In Android devices, the getCurrentPosition method returns nothing in the Then or Catch.

What I’ve already tried

I have read a lot of articles here in the forum, in stackoverflow and elsewhere and tried to apply everything that was tip to solve this problem. I already put it inside the “platform.ready ()”. Nothing, absolutely nothing solves that mistake!

I already came back version of Ionic Cli. I have already reinstalled entire node_modules.

This is frustrating and disappointing. Where is the Ionic engineering that does not solve this for the developer community? :rage:

Try that in a normal method outside the return new Promise

I think you cannot resolve a Promise within another Promise. Geolocaton works well with me.


this.geolocation.getCurrentPosition({timeout: 10000, enableHighAccuracy: true}).then((resp) => {

in a normal method, not inside a return, it should work

Thanks for the answer. But this not worked too!

It doesn’t print any error on console? I am using version 4.0.1. Try to put what’s inside <variable></variable> in your config.xml like mine

<plugin name="cordova-plugin-geolocation" spec="^4.0.1">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="Acceder a la localización" />

On which platform are you testing?

My config.xml is like your.
My ionic version is 4.1.2

Ionic 4 is a beta and totally not recommended to start a new project. Try it with Ionic 3 and if it works then go on with Ionic 3

I downgraded to version 3.9.2 and it still did not work.