GPS Drain

marcel

Active Member
Licensed User
Longtime User
Hi,

I have a program that gives messages based on your location. But this requires to have you GPS on all the time. Now I am thinking when a user stays long on the same spot it is really not needed that the GPS is on? But how do I know he is moving again?

Any other thoughts to safe battery?
 

sorex

Expert
Licensed User
Longtime User
the GPS library probably has a locationchanged event to prevent code being run all the time when not needed butI guess it will rely on the gps coords even when not moving.

Maybe you can use the accelerometer to detect movement and to enable the gps?
 
Upvote 0

lagore

Active Member
Licensed User
Longtime User
How accurate does the position have to be? if you only need a general location you can use the cell tower position this is probably accurate to 500 meters in a city and a couple of Km in the country.otherwise can you not switch on and off the GPS when required. Using the location provider with Wi-Fi turned on can give some very accurate results in urban areas.


Sent from my HTC One X using Tapatalk 2
 
Upvote 0

tunderin

Member
Licensed User
Longtime User
If you only need to determine that the user is moving, consider using a service that runs every couple of minutes and executes a simple pedometer routine to detect that the user is moving. The service can then toggle the GPS receiver on.

The service will also have to wake the phone if it shuts down the accelerometer when it goes to sleep.

Good luck...
 
Upvote 0

marcel

Active Member
Licensed User
Longtime User
How accurate does the position have to be? if you only need a general location you can use the cell tower position this is probably accurate to 500 meters in a city and a couple of Km in the country.otherwise can you not switch on and off the GPS when required. Using the location provider with Wi-Fi turned on can give some very accurate results in urban areas.

Well, it should be at the max 100 meter. So I am not sure this is working...

But I will give it a try...
 
Upvote 0
Top