1

The first fresh install of my app on Android doesn't retrieve the Geolocation. Android asks if I want to allow my location to be retrieved - I press 'Allow'. If I close the app and re-open the app then location is retrieved and all works well. Please note this all works perfectly on iOS.

Options are:

let options = {enableHighAccuracy: false};

Geolocation has been setup correctly returning a promise.

enter image description here

Close and open app after this and it works as expected.

My manifest:

enter image description here


I have also tried with these options:

enter image description here

The catch is eventually executed.

enter image description here

Josh
  • 2,430
  • 4
  • 18
  • 30

1 Answers1

0

It is completely expected behavior. Android requires Runtime Permissions from marshmallow and above. Developers need to request permission from user even if it is defined in the manifest. Users can also disable permission later by going into settings.

For the Geolocation plugin, it seems to be handling this internally.

If your plugin does not show the dialog in the beginning, you can check here to specifically ask permission.

Community
  • 1
  • 1
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
  • my dialog does show requesting to provide location, but after I press allow I still receive a geolocation timeout error. I have looked at the Diagnostic plugin but this won't fix my issue – Josh Feb 01 '17 at 06:08
  • timeout error would be unrelated to permissions.. have you tried kitkat version? or if the timeout still comes on second time. depends on your logs – Suraj Rao Feb 01 '17 at 06:09
  • the timeout still comes after calling a second time – Josh Feb 01 '17 at 06:13
  • http://stackoverflow.com/questions/12859425/phonegap-geolocation-allways-fail-on-timeout – Suraj Rao Feb 01 '17 at 06:21
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/134548/discussion-between-joshua-nissenbaum-and-suraj). – Josh Feb 01 '17 at 06:28