I am building a small app that relies on geolocation. I use the following code to get the current location from the device:
var options = { maximumAge: 3000, timeout: 300000, enableHighAccuracy: true };
navigator.geolocation.watchPosition(function(result) {
console.info(result);
}, function(error) {
console.error(JSON.stringify(error));
}, options);
However, this always call the error callback with an empty error object:
1 123317 error {}
There is no code nor message, just an empty object. Also interesting is that the error callback is called immediately, no matter what I set as timeout.
My AndroidManifest.xml looks like this:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
The result is the same weather I run it in the emulator or directly on my phone. If anyone has any idea on how to fix this, hints would be greatly appreciated.