This object is in archive! 

GPS auto-off now working when screen is off

Martin Lazar shared this problem 5 years ago
Solved

GPS auto-off feature works well, when "Keep auto-off enabled" is enabled and screen is on. When screen is off, the recorded track is smooth without any marks for GPS off. I tested it with "Min accuracy" sets to 1m to force GPS off even if there is a good signal. When "Keep auto-off enabled" is disabled, the GPS auto-off does not works at all.

Note, when GPS auto-off works (screen is on, "Keep auto-off enabled" is enabled), there is no beep/sound from "Position lost" notification, when the GPS is automatically turned off. I expected it notify me when the GPS is off.

Replies (16)

photo
1

Hi Martin,

are you a beta tester? We've just rebuilt getting location in Locus and it's available for testing in Locus Beta version available at Google PLa (http://docs.locusmap.eu/doku.php?id=manual:about:free_beta_testing). Perhaps the rebuild solves also your issue. Could you please test it?

Michal

photo
1

I tested the beta version 3.30.2.8. Now its better, but still not OK. When the screen is on, it works as expected. When the screen is off, it looks like the "GPS update interval" and "Max search time" is always 300 seconds, regardless of the real settings.

photo
1

Good day Martin,

may you please give it one more try with today published Beta version? I'm testing it now and can't simulate same problem you describe. Thanks!

photo
1

I tested the version updated today - 3.30.3 RC. I can still reproduce it. I tested it with the following settings:


  • GPS update interval: 60sec
  • Min accuracy: 1m
  • Max search time: 60sec
  • Keep auto-off enabled: true

In the attachment, there is a recorded a run (record settings: 1m OR 5sec). The important events from the record:

  • [18:17:05] start recording, screen is on
  • [18:17:57] GPS OFF (screen is still on, GPS auto-off works)
  • [18:19:00] GPS ON (~60sec, OK)
  • [18:19:56] GPS OFF (~60sec, OK)
  • [18:21:04] GPS ON (~60sec, OK)
  • [18:21:30±5s] I turn off the screen
  • [18:24:13] GPS OFF (~240 sec!, screen is still off, GPS auto-off somehow works, but does not follow the settings)
  • [18:29:19] GPS ON (~300 sec!)
  • [18:34:13] GPS OFF (~300 sec!)
  • [18:39:18] GPS ON (~300 sec!)
  • [18:39:40±5s] I turned the screen on
  • [18:44:07] stop recording (screen is still on, GPS is ON)

Note, after I turned the screen on, the GPS auto-off not working.

photo
1

Thanks for a testing Martin!

I finally found a source of troubles. I do not know what Android version you have, but optimizations made by Google in latest version case, that method I use to wake up device after the defined time, has new limits. Based on the state of the device, this is degraded to use only once per minute/three/five and even 15 in special "doze mode". In you case, it only works once per three minutes.

I've made small improvement and added one more method that may wake up device after the defined time, but can't guarantee it will work as expected. We will see in next version ;).

Thanks for now.

photo
1

Hello,

I tested v3.30.3.1 beta on Samsung Galaxy A3 2017 (SM-A320FL, Android 7.0). Now it's looks like the "Max search time" (GPS is ON) works, but the "GPS update interval" (GPS is OFF) is still 300 seconds.

Thank you.

photo
1

Thanks Martin for a tests. So seems that my "hack" does not work.

I'm sorry, but then I have currently no solution. All other methods need to keep the system awake and then GPS auto-off feature will be completely use-less. Seems we will have to add warning, that on some new devices, "update interval" may increase up to 15 minutes I found earlier.

Ah, maybe also check if you have disabled optimizations for Locus Map as we write here: http://docs.locusmap.eu/doku.php?id=manual:faq:gps_lost_fix_android6

Thanks for understanding,

Menion

photo
1

I have disabled all optimizations. I'm also going to test the Memory Locker mentioned in the FAQ.

Because I would like to use the GPS auto-off feature not to save the battery but to fix GPS accuracy (see Zpresneni GPS pravidelnym vypinanim/zapinanim GPS), what about workaround / new feature - if the "GPS update interval" is small, e.g. less then 10s (or even zero), do not put the device to sleep between GPS OFF and GPS ON.

photo
1

Hmm.

"do not put the device to sleep" ... and this is interesting. Locus do not put device to sleep. Locus just disconnect from GPS system. If device is put into sleep, it Locus can't influence. How it works when you set "update interval" to 10 seconds? Same problem, also Locus wake up device after 300s, not sooner?

photo
1

I will test the 10 seconds update interval, but I thing that the GPS will be OFF for 300 second. I reported this bug as the GPS auto-off does not works at all. Actually I tested it with GPS ON 60s / GPS OFF 10s and I never wait at least 300s so its looks like GPS auto-off does not works at all. Later, I tested it with intervals 45s - 120s and wait for mote time and the recorded GPS ON/OFF was always 300s.

"do not put the device to sleep" ... I imagine there is a code like "while GPS_accuracy()<MinAccuracy; do GPS(OFF); sleep(UpdateInterval); GPS(ON); sleep(MaxSerchTime); endwhile" and the problem is that the sleep() will actually sleep for 300s regardles of the arguement. My idea to fix it is to skip the sleep(UpdateInterval) if the UpdateInterval is zero (and allow it to be zero). It will not save the battery, but restart the GPS and fix GPS accuracy problem. But I never programmed for Android, so the real code may be completely different and the fix not works...

photo
1

Understand. I may be in the end easier to write some function "restart GPS every X sec" as you wanted in original idea 2 weeks ago. I just don't like such weird tools usable for one person from million, sorry.

Please try with latest version 10 sec interval a little bit and let me know. As I wrote, I made there some changes and I believe, it may help here. Thanks for understanding.

photo
1

"I just don't like such weird tools usable for one person from million"... I understand. But as I searched for the solution before I fill the feature request, I found that I'm not alone. It's looks like all Samsung Galaxy A3 (2017) and A5 (2017) owners have the accuracy issue (see xda-developers forum), some Xperia devices have a similar problem where the restart GPS solve it (see locus forum), and several other issues where the restart GPS fix it (sorry, I do not bookmark it).

photo
1

Personally, my GPS restart with Auto-OFF works in the last BETA without any problems. Settings 10,1,180, ON. I attach the SCR to see how the GPS turns off after three minutes. (Bright places in the record). I ran part of the route with the screen illuminated, part turned off, and in both cases Auto-Off worked.

photo
1

Thanks, Josef, I believe this works correctly for most of the devices. Just some of them and little more aggressive and put device to sleep mode immediately when there is a chance.

Martin, try it with 10 secs please with the latest version as I wrote. After that we may talk about it.

I can imagine some special settings for this. Little crazy :) but doable ...

photo
2

I think we have the same Galaxy A3 with Android 7 with Martin. That's why I wrote. A shorter reset than three minutes does not make sense to me. There will always be less accuracy after the reset. While walking, it's often seen in the detail of the record with a small loop.

photo
1

I tested it with GPS auto-off setting 10,1,180,ON - and it works! Actually from my 20 minute run, GPS OFF interval was 11 or 12 seconds, just once it was 40 seconds (maybe low GPS signal to fix the position?), great.

Thank you!

Do you need to test another ON/OFF intervals?

photo
1

Perfect. In this case, it is probably because of change I made in the latest version. 12 seconds confirm it (defined 10 seconds interval + 2 seconds delay).

No need to test other intervals. Your and also Josef test confirm that GPS auto-off function now works correctly (if the system does not have some crazy optimizations enabled), which is important for me.

Hope it will work for you as expected. Thanks for tests.

Replies have been locked on this page!