yasuhal / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 1 forks source link

Automatically restart my tracks if phone reboots #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If mytracks was recording a track and the phone reboots for some reason, we
should resume recording after the reboot.

This may be as easy as adding an on-boot intent receiver which checks if
something was being recorded, and if so resumes it.

Original issue reported on code.google.com by rdama...@google.com on 18 May 2010 at 9:25

GoogleCodeExporter commented 8 years ago
What is the status on this? How do I make sure that MyTracks can continousely 
record my positions? Or can I do this myself by quering MyTracks from another 
app? I saw that it should be possible to do so, but it did not say how. Please 
assist!

Original comment by Simon.Mo...@gmail.com on 1 Sep 2010 at 9:23

GoogleCodeExporter commented 8 years ago
I'm going to take on this request.

We can use ACTION_BOOT_COMPLETED intent and check whether the previously 
recorded state indicates whether tracking was in progress or not (it could be 
either TRACKING or PAUSED) and resume from that point.

A few things to consider:
1) How much time elapsed since the last state (e.g. user rebooted phone after 
several hours); resuming makes sense if the time is reasonably short, e.g. 5 
min?
2) Whether the current position is significantly different from the last 
tracked (it probably doesn't make sense to resume if user for some reason moved 
100 miles)
3) We need to make sure that we attempt to resume no more than N times; imagine 
that the reboot was caused by a bug in MyTracks, the last thing we want is to 
enter infinite reboot loop ;-)

Bart

Original comment by ba...@google.com on 8 Sep 2010 at 4:41

GoogleCodeExporter commented 8 years ago
Nice.

I agree with your comments:
1) I think the time should be a bit longer to cover the case where someone runs 
out of battery and needs time e.g. to get the car charger and plug it in.
2) The distance is highly dependent on the activity type, so remember someone 
may be recording from a plane or TGV.
3) Agreed - and hope that if there's such a case, the reboot is caused by 
something run after the boot completed receiver :) I have seen very few bugs in 
Android that cause a reboot though (most common one being opening Google Wave 
in a phone with < 256M of RAM)

Original comment by rdama...@google.com on 8 Sep 2010 at 2:11

GoogleCodeExporter commented 8 years ago
...I came back from a ride this evening happy to import a KOM, as I was pretty 
sure I beat the previous leader, and I found to my surprise that MyTracks was 
no longer running.  Quick debug revealed that my phone crashed shortly after I 
started commuting back home... no segment record with the new KOM :(  Well, I 
learned my lesson and I've just sent a code review that I created some time ago 
and finished just now.

Sorry for the delay.

Quick summary:
I've implemented only 1) as I think this is probably the most useful signal to 
check on.

The pending code review is here: 
http://code.google.com/p/mytracks/issues/detail?id=167.

Original comment by ba...@google.com on 29 Sep 2010 at 6:01

GoogleCodeExporter commented 8 years ago

Original comment by rdama...@google.com on 5 Oct 2010 at 7:55

GoogleCodeExporter commented 8 years ago
One more update:
I also implemented 3) -- currently, we try up to 3 times for a given track.  
Once a new track is started, the retry counter is reset to 0.

Original comment by ba...@google.com on 5 Oct 2010 at 8:00