cordova - Unable to get location using Geolocation/HTML5/Phonegap since 2 days ago -
my code working fine, used location , search nearest subjects (cars), stopped working , fails on trying location, returning "time out expired".
tried in several devices , same:
var getlocation = function() { document.getelementbyid("lat").innerhtml = '<img src="img/ajax-loader.gif" />'; document.getelementbyid("lng").innerhtml = '<img src="img/ajax-loader.gif" />'; var suc = function(p) { document.getelementbyid("lat").innerhtml = p.coords.latitude; document.getelementbyid("lng").innerhtml = p.coords.longitude; }; var locfail = function(error) { document.getelementbyid("lat").innerhtml = 'not found'; document.getelementbyid("lng").innerhtml = 'not found'; }; navigator.geolocation.getcurrentposition(suc, locfail, {maximumage: 0,timeout: 6000, enablehighaccuracy: true}); };
try this...
navigator.geolocation.getcurrentposition(suc, locfail, {maximumage:3000,timeout: 6000, enablehighaccuracy: true}); put maximumage:3000 ,in code 0 that's why getting error.
Comments
Post a Comment