Geolocation Android 6 request permission fires catch() ignoring timeout

Hi!

I’m developing a “yet another geolocation app” and when I testing
with Android 6 device with “ionic run android --prod” (AoT enabled)
the catch() of Geolocation.getCurrentPosition() is fired before Android OS ask for
permission.

I call to Geolocation.getCurrentPosition({ timeout: 30000}) inside ionViewDidLoad()

In Cordova geolocation plugin advise to use timeout for Android 6.

Any idea or workaround? Is it a bug?

Thanks!

My environment:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: OS X El Capitan
Node Version: v7.2.1
Xcode version: Xcode 8.0 Build version 8A218a

Solved!

Due to a great improve of speed in execution, Geolocation.getCurrenntPosition() was being executed before “platform.ready()” :frowning:

So that, putting the code inside the promise, works fine :slight_smile:

1 Like