radiocells-scanner-android icon indicating copy to clipboard operation
radiocells-scanner-android copied to clipboard

When in background, logging stops after ~3 hours

Open GoogleCodeExporter opened this issue 10 years ago • 4 comments

What steps will reproduce the problem?
1. Start logging.
2. Switch to a different app and do something else for more than about ~3 hours.
3. Move away by a few hundred meters (preferrably *not* in a straight line).
4. Return to Radiobeacon and check the map view.

What is the expected output? What do you see instead?
I'd expect to see Radiobeacon return to its previous view, and see my last 
movements I made prior to returning to Radiobeacon (including all wifis) in the 
map view. Instead, I get the track list with a clock icon next to the current 
track. When I tap it and go to Map view, I see that the log seems to stop ~3 
hrs from the start, and was resumed only when I tapped it in the list again. 
Instead of my last movements prior to callind Radiobeacon again, I just see a 
straight line from where the log seems to have stopped, and no wifis during 
that period.

What version of the product are you using? On what operating system?
0.8.4, from F-Droid, on Cyanogenmod 11.0m11.

Please provide any additional information below.
Apparently Android kills the logging service. This can be prevented by making 
the service a foreground service. OSMTracker for Android had the same issue, 
see https://code.google.com/p/osmtracker-android/issues/detail?id=182.

Original issue reported on code.google.com by [email protected] on 18 Feb 2015 at 5:55

GoogleCodeExporter avatar Aug 01 '15 16:08 GoogleCodeExporter

Original comment by wish7code on 18 Feb 2015 at 8:55

  • Changed state: Accepted

GoogleCodeExporter avatar Aug 01 '15 16:08 GoogleCodeExporter

Pretty interesting stuff in the link you posted.

I wasn't even aware of the fact, that services could get killed. The 
setForeground API nevertheless seems to be deprecated for some time (
http://stackoverflow.com/questions/5647815/can-anyone-explain-the-service-setfor
eground-method)

I went for the startForeground method mentioned in above post instead. 
r9702d43b03b4 starts the Wireless Logging Service as a foreground service. 

Let's see whether this helps. There's still a chance that we have to start all 
services foreground (i.e. gps positioning, gpx loggging services), but I hope 
we can avoid that as each service started foreground would need a separate UI 
notification.

Another option would be to start wireless logging service as foreground service 
and restart other services as needed.

Original comment by wish7code on 18 Feb 2015 at 9:39

  • Changed state: Started

GoogleCodeExporter avatar Aug 01 '15 16:08 GoogleCodeExporter

Kept the client successfully running and tracking for ~5 hours in background 
(although no heavy CPU/RAM load during that time)

Original comment by wish7code on 19 Feb 2015 at 9:19

GoogleCodeExporter avatar Aug 01 '15 16:08 GoogleCodeExporter

I wonder if declaring foreground should always happen, or only if the user asks for it in a settings checkbox. Android has the notion of killing things when RAM is low, and which things are more important is a personal choice - a world where every app thinks it is more important than all the others won't work. It would make sense to have a "this is actually doing something in the background" notion, though, and maybe that's all this is.

See #105 which reports the wakelock being kept. I wonder if this is due to foreground priority for the logger. Probably when logging is not running that priority request should be withdrawn.

gdt avatar Dec 19 '15 15:12 gdt