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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -