javascript - Ionic - navigator.geolocation returns empty error object -
i building small app relies on geolocation. use following code current location 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, always call error callback empty error object:
1 123317 error {}
there no code nor message, empty object. interesting error callback called immediately, no matter set timeout.
my androidmanifest.xml looks 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 same weather run in emulator or directly on phone. if has idea on how fix this, hints appreciated.
use following code
var options = { enablehighaccuracy: true, timeout:5000, maximumage: 0 };
Comments
Post a Comment