Can I avoid wakelocking on tracking hike? (gain and lose GPS fix on time interval w/o wakelocking)

Šimon Demočko shared this question 3 years ago
Answered

On this http://softwarerecs.stackexchange.com/q/24568/16694 stack exchange site I have been suggested this application: http://code.mendhak.com/gpslogger/ for its ability to turn off GPS fix and thus removing wakelock on the device during tracking in between the tracking points.

This proved by my testing on 100 km hike in Slovakia on Nízke Tatry as very efficient, because when I tracked with the app, I only had the awake state for a few seconds to get the GPS fix and track the point and after that the wakelock was dropped which resulted in extreme battery life savings. Compared to any other tracking app including Locus, which keep the GPS fix on, even when I request to track a point only every 3 minutes or so (which is perfectly okay for a mountain hike), I get very poor battery life results. You can imagine that an average smartphone which is wakelocked and fixed with GPS does not survive more then half a day. I wanted to track 5 days straight. This was possible with a power bank and this new free app.

I noticed when I looked through settings that you offer tracking very similar to the one in this other app, with just this one small difference - there is no option to drop the GPS fix in between the points and lose wakelock which makes all the battery life difference I need.

Is there some option and I missed it? If not, would you plan to add it? If yes, it would make me a buyer of your PRO version, cause I like to have one app for everything.

Lemme know.

Comments (19)

photo
1

Good day Šimon,


I'm sure, you have missed it ;). Please check this one: http://docs.locusmap.eu/doku.php?id=manual:user_guide:settings:gps#internal_gps_auto-off ( Internal GPS auto-off).


This is exactly feature that helps to save battery in cases, you do not need GPS fix too often.

photo
1

Okay, this is great, I really did miss it. However,


How does GPS update interval limit setting play with the time interval for recording trackpoints?


This is not very clear to me:


- If I have a time interval for trackpoints 200 seconds and time interval for gps fixes 250 seconds, will every other trackpoint have the same GPS coordinates and thus result by being dropped?

- Or the other way around, If I have a trackpoint every 250 seconds, and GPS fixes every 50 seconds, will it unnecessarily wakelock device every 50 seconds, even though I actually need a fix only every 250 seconds?

- If I will have matching settings for the two, but the seconds for trackpoint will pass and the fix is not acquired instantly but after few seconds, the data from last fix will be used resulting in an innacurrate trackpoints?


From what I read, it seems, like the time of the fix is not matched with the time of the trackpoint and the trackpoint will only get a last fixed coordinate irrelevant to the actual time it was made and possibly, assigning the time of the trackpoint non-matching with the time the fix was made - resulting in incorrect tracking data and statistics.


The other app I mention has only one setting and it wakes up the device TO get the trackpoint, which results with waking only at the time of the trackpoint and exactly at the time of the trackpoint - correct data, non-redundant fixes.


Am I understanding it well? Or does it have some inside logic which I cannot see from the outside, which avoids these issues?


(btw I will always leave record when GPS is off unticked - network and wifi do not provide reliable data while hiking so I cannot use that)

photo
1

Hi Šimon,


Menion has forwarded the topic to me.

Locus Map doesn't have the feature of the app you mentioned, i.e. timed triggering of GPSfix/recording a trackpoint/GPS off. Your requirements could be perhaps accomplished by various settings of the GPS auto-off feature and recording profile - time of switching GPS on, time of recording a trackpoint and required GPS accuracy for the trackpoint recording. Have you got any testing results?

photo
1

At the moment I only have one recording, but I cannot really tell if the functionality is doing what I want or not from that, becaue I just randomly turned it on, hoping to be able to analyze it later while I was on a trip to Bratislava - but I looked for some geocaches, later sat with a friend on a beer and then used public transportation, so the movement was very irregular, so changes in trackpoint frequency can be unrelated to the issue.

At the moment I do not feel like I have time to go out to make a regular movement of sufficient length just to analyze this. Hopefully in the near future I will have some good conditions to try it out, but it would be good to know what combination of settings could show, if the app can fit the requirements. E.g. if I should set the GPS fix auto-turn-on/off interval slightly lower / same as trackpoint frequency, or some multitudes lower then the trackpoint frequency.

At the moment it is still easier to use the tried open source product, since it has this functionality built in, but it would be nicer to do it right from Locus.

photo
2

Try this: set your recording profile for mountain hiking as if you used GPS permanently on, i.e. for example time interval 5 secs, distance doesn't matter (1000 m), select Distance OR time condition. Then go to settings > GPS&location > Disable location > Track recording ON, GPS auto-off ON, GPS update interval 180 (or more) s, min accuracy cca 20 m, max search time cca 10-20 s (depending on quality of your device). Check also "keep auto-off enabled". I guess this setting should work like you expect.

photo
1

I will give it a go next time I go out, but I presume, if the interval for trackpoints will be 5 secs, then the device will have to get to awake state to log a new trackpoint, no? Will this not result in device being awake every 5 seconds or all the time altogether? (I do not mean screen-on time, just awake state).

I will let you know of the results, next time I try it out. Thank you for your suggestions.

photo
1

Well I'm not sure if I understand what you mean by "awake state". The phone will have to stay switched on of course, Locus Map can't switch the phone on itself. Only the GPS will get fixed only in 3 minute (or as you set it) intervals and the app records a point or two.

photo
1

By awake state I mean it will be wakelocked. For example you can see it on this picture here: http://puu.sh/kc3iz/1493fac487.png The "awake" is sometimes on sometimes off. It is always on, when the Screen is On (below), but sometimes also when screen is off, but device is turned on. If a device keeps a wakelock, then the device is awake during the whole wakelock period. This is an extreme battery drainer. Any tracking app, be it runtastic, endomondo.. they always keep your device awake for the whole tracking period which results in very poor battery life. The app I mention - the GPS logger drops the GPS fix and drops the wakelock. It awakes the device only to get the GPS fix, log a point and then leaves awake which results in very good battery life. Locus with no special settings behaves like any other app - keeps phone awake during tracking, drains battery. I am looking for a setting, which would result in a similar behaviour as GPS logger has - keeping wakelock only for the logging process every once in a while - saving tons of battery - allowing for multiple days hike tracking.

photo
1

I think some of it is described also here: https://developer.android.com/training/scheduling/wakelock.html#cpu "To release the wake lock, call wakelock.release(). This releases your claim to the CPU. It's important to release a wake lock as soon as your app is finished using it to avoid draining the battery."

photo
2

fine, then try the settings I proposed, I am curious myself if it will work as you need.

photo
1

Hi Šimon, any testing results of the proposed GPS on/off settings?

photo
1

Hi,


I am sorry, but I wasn't out for a hike for a while. I guess I can just try it out when I go out next time to do some errands. Hopefully I will think about it.

photo
1

OKay. As for your question that seems to remain unanswered - Locus is wakelocked only when GPS is switched on - track recording doesn't need wakelock. Anyway, it's worth testing if it suits your requirements.

photo
1

What exactly is wakelocking ?

Is it having an application available on otherwise locked device, as I can see sometimes ?

photo
1

Every Android monitor activity of application and when system decide, that CPU is no more needed, it may puts itself into "sleep mode". There is a few variants of this sleep, but most welcome by users and most hated by developers is "deep sleep". This limit functionality of whole device, usually turn of GPS, disable internet access and limit CPU power a lot. Such "deep sleep" enabled during track recording cause that you will record nothing :).


When GPS is enabled in Locus, Locus use technique called "Wakelock" which force system not to put itself to "deep sleep" and keep awake. Thanks to this, GPS is still available.


Track recording service itself do not use this "wakelock" mechanism, but "GPS service" do. Anyway "GPS auto-off" feature disable GPS in Locus so it also temporary disable wakelock for defined time, so device may put itself into "deep sleep" for a while. Locus then awake device when needed. Clever system that seems to work :).

photo
1

Ahh, I see.


I supose this deep sleep may be the Stamina mode in context of Sony Xperia phones. Sometime the system complains some application prevents the device to go to the Stamina mode. Applications can be put in exception list, not to sleep in Stamina mode when they are running.

photo
1

I think Sony has some own secondary system how to reduce power drain. It will be little bit different, but system is similar.

photo
photo
1

Hi, so today I was hiking and I tried it. And I am happy to say, that apparently it does what it should. Phone in deep sleep awaking only on given time to track a point. I did have a tracked wakelock for 30 minutes however, called AFK. This is different from the previous one which was ZR I think before. The AFK however, I believe was maybe the one which was keeping also the screen alive, when I was interacting with the map and then leaving it untouched for a while? Not sure though. However a 6 hour hake with just 30 min. wakelock is very satisfiable. Or maybe it was actually the summary of all the times it woke up for the point and the time required for gps fix and track. anyway, I am happy. (btw, what is locus sharing to facebook good for? It only opens the locus site, does not show any tracking data or anything)

photo
1

Great news Šimon. We're happy to make our users happy :) Enjoy your hikes and stay with us!