projects
/
lantea.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
support and set GPS wakelock for Firefox OS
[lantea.git]
/
js
/
map.js
diff --git
a/js/map.js
b/js/map.js
index c7a69e835d56ed86f3548dbcc6930b4cb99be27a..f02386bc986190d4451ac5b1904745707d95acdb 100644
(file)
--- a/
js/map.js
+++ b/
js/map.js
@@
-75,7
+75,7
@@
var gMapPrefsLoaded = false;
var gDragging = false;
var gDragTouchID, gPinchStartWidth;
var gDragging = false;
var gDragTouchID, gPinchStartWidth;
-var gGeoWatchID;
+var gGeoWatchID
, gGPSWakeLock
;
var gTrack = [];
var gLastTrackPoint, gLastDrawnPoint;
var gCenterPosition = true;
var gTrack = [];
var gLastTrackPoint, gLastDrawnPoint;
var gCenterPosition = true;
@@
-1119,6
+1119,9
@@
function startTracking() {
if (gGeolocation) {
gActionLabel.textContent = "Establishing Position";
gAction.style.display = "block";
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) {
gGeoWatchID = gGeolocation.watchPosition(
function(position) {
if (gActionLabel.textContent) {
@@
-1174,6
+1177,10
@@
function endTracking() {
gActionLabel.textContent = "";
gAction.style.display = "none";
}
gActionLabel.textContent = "";
gAction.style.display = "none";
}
+ if (navigator.requestWakeLock && gGPSWakeLock) {
+ console.log("releasing WakeLock");
+ gGPSWakeLock.unlock();
+ }
if (gGeoWatchID) {
gGeolocation.clearWatch(gGeoWatchID);
}
if (gGeoWatchID) {
gGeolocation.clearWatch(gGeoWatchID);
}