Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
None
-
None
Description
With a Google LG Nexus 5X and I can't manage to make getCurrentPosition() work.
I have Wi-Fi on, Location on high accuracy, Mobile data on, even Bluetooth on, but nothing.
You can replicate by running this code in the Chrome Dev console (via Remote devices):
var geoOptions = { timeout: 10 * 1000 } var geoSuccess = function(position) { alert('Success! Lat: ' + position.coords.latitude + ' . Long: ' + position.coords.longitude); }; var geoError = function(error) { alert('Error occurred. Error code: ' + error.code); // error.code can be: // 0: unknown error // 1: permission denied // 2: position unavailable (error response from location provider) // 3: timed out }; navigator.geolocation.getCurrentPosition(geoSuccess, geoError, geoOptions);
I also managed to reproduce with a cordova plugin and ionic native showcase app:
- https://play.google.com/store/apps/details?id=br.com.marcioggs.cordovashowcase&rdid=br.com.marcioggs.cordovashowcase
- https://play.google.com/store/apps/details?id=com.ionichelper.ionic2native&rdid=com.ionichelper.ionic2native
(though no error appears)
Code the 1st app is here: https://github.com/michaelrbk/showCaseCordova/blob/master/www/js/geolocation.js
Trying a phone with Android 6 is fine.
Could this be related to this?
https://developer.android.com/about/versions/oreo/background-location-limits.html