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 ?
Thanks for the reply, but I already use that. The problem is I don't always remember to exit the application and it drains the battery. What I would like to do is set a timer of some sort to shut it down after a few hours.
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.
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.
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.