X-Git-Url: https://git-public.kairo.at/?p=lantea.git;a=blobdiff_plain;f=js%2Fmap.js;h=f02386bc986190d4451ac5b1904745707d95acdb;hp=f214881ee9084276418f68d7b72707b87cc90574;hb=d361104be0372268e187b7576042127090375566;hpb=7ef765750ee7eac523572bbd87396491fe955be1 diff --git a/js/map.js b/js/map.js index f214881..f02386b 100644 --- a/js/map.js +++ b/js/map.js @@ -75,7 +75,7 @@ var gMapPrefsLoaded = false; var gDragging = false; var gDragTouchID, gPinchStartWidth; -var gGeoWatchID; +var gGeoWatchID, gGPSWakeLock; var gTrack = []; var gLastTrackPoint, gLastDrawnPoint; var gCenterPosition = true; @@ -169,7 +169,6 @@ function loadPrefs(aEvent) { gAction.addEventListener("prefs-step", loadPrefs, false); gWaitCounter++; gPrefs.get("active_map_style", function(aValue) { - console.log("active_map_style: >>" + aValue + "<<"); if (aValue && gMapStyles[aValue]) { gMap.activeMap = aValue; } @@ -1120,6 +1119,9 @@ function startTracking() { if (gGeolocation) { gActionLabel.textContent = "Establishing Position"; gAction.style.display = "block"; + if (navigator.requestWakeLock) { + gGPSWakeLock = navigator.requestWakeLock("gps"); + } gGeoWatchID = gGeolocation.watchPosition( function(position) { if (gActionLabel.textContent) { @@ -1175,6 +1177,10 @@ function endTracking() { gActionLabel.textContent = ""; gAction.style.display = "none"; } + if (navigator.requestWakeLock && gGPSWakeLock) { + console.log("releasing WakeLock"); + gGPSWakeLock.unlock(); + } if (gGeoWatchID) { gGeolocation.clearWatch(gGeoWatchID); }