opc0de
opc0de

Reputation: 11768

Do I need an Alarm or a Service to perform a repetative task?

I am developing a gps tracking for Android i want my application to start when the phone boots up and send gps coordonates from 10 in 10 minutes.

Do i need to use a service or an AlarmManager broadcast receiver can do the job ?

Upvotes: 0

Views: 41

Answers (2)

NullPointerException
NullPointerException

Reputation: 4008

Prefer the AlarmManager over the service if your frequency of getting the geo co-ordinates is much lesser say 1 location in few miutes...

Otherwise if your frequency is much higher say for every 20/30 seconds then prefer service because AlarmManager is quite heavy in the case of few seconds to remind...

Upvotes: 1

Plamen Nikolov
Plamen Nikolov

Reputation: 4187

You can start service on phone boot and listen for coordinates changes. See this article

Start service at boot

Upvotes: 1

Related Questions