ionic framework - Not getting current location using cordovaGeolocation -
i tried current location of app using cordovageolocation failed get. gps on can't current location following code
var posoptions = {timeout: 20000, enablehighaccuracy: false}; $cordovageolocation .getcurrentposition(posoptions) .then(function (position) { lat = position.coords.latitude long = position.coords.longitude console.log("lat " + lat + " long " +long); }, function(err) { // error console.log("error"); }); var watchoptions = {timeout : 20000, enablehighaccuracy: false}; var watch = $cordovageolocation.watchposition(watchoptions); watch.then( null, function(err) { console.log(err) }, function(position) { lat = position.coords.latitude long = position.coords.longitude console.log(lat + '' + long) } ); watch.clearwatch();
how can current location? above code not helped me solve issue. didn't current location in device please me solve issue
have @ this: http://www.gajotres.net/using-cordova-geoloacation-api-with-google-maps-in-ionic-framework/
it's usefull!
Comments
Post a Comment