Android Question frozen gps

cjolly

Member
Licensed User
Longtime User
Hi,

I have the following situation:

A routine that runs as a service to take gps positions, after a certain time the device stays without moving the gps always marks the same position which is fine but if you ask for the date and time (Location . time) looks like to stay frozen without any change no matter what the device moving again and in this case we see that the gps position not retaken.

Any idea what might be happening or how to prevent this from happening?

*TIA*
 

cjolly

Member
Licensed User
Longtime User
Thanks for your reply.

I take position every 30 seconds continuously on 24/7 base, the problem happens sometimes not always, and not necessarily the phone is in use, and that is what confuses me most.

Any clue?
 
Upvote 0

MotoMusher

Active Member
Licensed User
Longtime User
I do the same, but in 5 minute intervals. 30000 should be fine as far as frequency.

One thing I did was not to leave it run. I do a servicestartat after my interval (500). Saves a bunch of battery life and I have had less issues. Once you get it dialed in, it works like a charm. At 30 seconds though, you could run into issues getting a lock with my method however. Do the servicestartat after you get a good lock rather than before.

Just off the top of my head, check your "if" statements. Are you using location.accuracyvalid? I had escaped out of one of my sequences doing that and never went back and shut if off.

One thing I ended up doing was to add a text file log in the location event. and the subs I called from there. It helps a lot for infrequent problems.
 
Upvote 0

cjolly

Member
Licensed User
Longtime User
Maybe my problem is in the time range of StartServiceAt I had it very short (10) I go to expand and check and see if the problem occurs again.

Thanks for the support, any news I gone post here.
 
Upvote 0

MotoMusher

Active Member
Licensed User
Longtime User
That will mess you up for sure.

I do this as the last step of my service


B4X:
  Dim restartint As Long
  restartint = DateTime.Now + MyAuth.MinTime
  StartServiceAt("GPSService", restartint , True)
  stopservice("GPSService")

I also start a timer when service starts so the service does not get stuck. When timer hits, stop gps, then this code is in there as well. It cures hang up problems, or lock issues when inside pretty well. Doing the servicestartat in the beginning caused me problems as the original service may still be running if there is a problem.
 
Upvote 0
Top