Android Question How do I stop a GPS app ?

Phil

Member
Licensed User
Longtime User
I have a GPS app running. If I forget to stop the app it continues and runs down the battery. I stop the GPS in the Activity_Pause sub, but it still seems to use up battery. What is the best way to automatically stop an app after a set time? A service module maybe ?
 

Phil

Member
Licensed User
Longtime User
Upvote 0

rbsoft

Active Member
Licensed User
Longtime User
Is your app continously running in the forground, not allowing the device going in to sleep mode?

In that case a simple timer would do the job. You could initialize a timer with an interval of 60,000 (1 minute), set a global counter variable. In the timer_tick event count the counter up to 30, and then finish the program. You could reset the counter if something is done in the program so that it will not stop while you are busy with it.

Rolf
 
Upvote 0

Phil

Member
Licensed User
Longtime User
Is your app continously running in the forground, not allowing the device going in to sleep mode?

In that case a simple timer would do the job. You could initialize a timer with an interval of 60,000 (1 minute), set a global counter variable. In the timer_tick event count the counter up to 30, and then finish the program. You could reset the counter if something is done in the program so that it will not stop while you are busy with it.

Rolf

No the device goes into sleep mode. I even use the GPS.stop command in the Activity_Pause sub then restart it in the Activity_Resume sub, yet it still seems to use up the battery.
 
Upvote 0

rbsoft

Active Member
Licensed User
Longtime User
Is the GPS icon still in the notification bar after your program stopped?

Rolf
 
Upvote 0
Top