cordovaGeolocation, what is the problem?


#1

Hello, i use the cordova plugin for geolocation but on many times the getCurrentPosition don’t return me the position of the user.

The plugin return me this:

PositionError { code: 2, message: "Unknown error acquiring position" }

I would to know the reason of this error …

Thanks !


#2

Hello, anybody have a replies ?


#3

Hello, anybody have a replies ?
up


#4

I have similar problem. I tried cordovaGeolocation but it doesn’t work for me at all. Unfortunatelu not many users can help with this problem. I’m still waiting for answers on my question.


#5

Could you please post a codepen? We need to see some code before trying to help you.
Thanks


#6

In case someone else stumbles on this.

The error codes according to the source code

NSLog(@“locationManager::didFailWithError %@”, [error localizedFailureReason]);

CDVLocationData* lData = self.locationData;
if (lData && __locationStarted) {
    // TODO: probably have to once over the various error codes and return one of:
    // PositionError.PERMISSION_DENIED = 1;
    // PositionError.POSITION_UNAVAILABLE = 2;
    // PositionError.TIMEOUT = 3;
    NSUInteger positionError = POSITIONUNAVAILABLE;
    if (error.code == kCLErrorDenied) {
        positionError = PERMISSIONDENIED;
    }
    [self returnLocationError:positionError withMessage:[error localizedDescription]];
}