2016-06-22 5 views

Antwort

0

Wenn Sie die link im Thread verfolgen, sehen Sie den gesamten Beispielcode auf github.

Sie können den aktuellen Standort erhalten, indem Sie diese:

var location = geolocation.getCurrentLocation({desiredAccuracy: 3, updateDistance: 10, maximumAge: 20000, timeout: 20000}). 
then(function(loc) { 
    if (loc) { 
     // Your code here 
    } 
}, function(e){ 
    console.log("Error: " + e.message); 
}); 

Wenn Sie es zu aktualisieren halten möchten, können Sie verwenden:

var watchId = geolocation.watchLocation(
function (loc) { 
    if (loc) { 
     // Your code here 
    } 
}, 
function(e){ 
    console.log("Error: " + e.message); 
}, 
{desiredAccuracy: 3, updateDistance: 10, updateTime: 1000 * 20}); // should update every 20 sec according to google documentation this is not so sure. 
+0

Thank you so viel, das ist genau das, was ich war Auf der Suche nach! – Terhoraj