My application is based on Google Map
and Location
which includes client-server communications. Apart from all that, periodically I want to update the user location to web server. I gave thought myself and ended up with below two scenarios,
First One :
I use Service
class to fetch user location periodically (considering 2-3 hours once) and update to server. Ideally I want to avoid this! Because just to upload user location its not good to run the service all the time is what I feel.
Second Thought :
I can use IntentService
to fetch the user location periodically (considering same 2-3 hours) and update to web server. Here IntentService
will be invoked by an AlarmManager
. That is every 2-3 hours once alarm manager will start IntentService
.
But I feel using AlarmManager
for 2-3 hours once is not a good idea too.
I want to understand which one will be efficient and more relevant! Whether this scenario can be implemented in any other approach? If so help me do it!
Thanks in advance...