Android Location Update every 30 seconds
If I determine the phone is active by reading the accelerometer, I want to update the location of the phone every 30 seconds. If after a while, I determine it's not moving, I stop the location updates.
Is it better to leave a LocationListener on during that time, or is it better to register a LocationListener every 30 seconds, get an update, and unregister?
For both methods, I would timeout after a while if I can't get a location update. I want to know which method is开发者_运维百科 better in terms of both getting consistent updates and battery life.
And I'm trying to get updates through GPS satellites, not network, even though I know network is faster and less battery consuming, but I need to get it through satellites. Please keep that in mind.
IMHO, 30 seconds is to fast to get the listener, get an update, and shut it back down. The only exception to that may be if you are willing to accept a very large accuracy number. If you really need it every 30 seconds, leave it active, but the battery suffers.
精彩评论