In android I need to execute some code every 5 minutes and finish it after 2 minutes when running.
What is better to use:
http://developer.android.com/reference/android/os/CountDownTimer.html
or
http://developer.android.com/reference/android/os/Handler.html
I know how to implement both but I don’t know what is better and what use less memory and battery=
Neither. Use
AlarmManagerand anIntentService, with theIntentServicedoing the work and abandoning it after two minutes if the work is not yet completed.