El Dude
El Dude

Reputation: 5618

ionic2 android geolocation timeout

I am trying to get the default ionic2 geolocation plugin to run on my android test device. Works in browser and iOS, but fails with a timeout on android.

PositionError {code: 3, message: "Timeout expired"}

Here's the code

Geolocation.getCurrentPosition({ maximumAge: 60000, timeout: 30000, enableHighAccuracy: true }).then((position) => {
console.log(position);
}, (error) => {
      console.log(error);
    });

The manifest contains

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.location.gps" />

Yet it fails. Any ideas how to solve this?

Upvotes: 1

Views: 589

Answers (1)

El Dude
El Dude

Reputation: 5618

Trick 17 - seems on Android you sometimes have to delete the deployed app, reboot the phone and reinstall to update the app. Worked after this very procedure.

Upvotes: 1

Related Questions