I'm fresh with Android. I face some ambitious university project, so I hope you'll tell me if my idea about following app's implementation is correct and efficient:
Business scenario:
- WebService consumes informations about user's sms (sendt/received) and GPS/"network provided" position
- GPS/"network provided" position's should be sendt to WebService every 1 minute (if it's value changed)
- sms update should be sendt to WebService immediately
My implementation idea...
I'm going to use AlarmManager prepare Intent matching BroadcastReceiver (and schedule it with 1 minute interval). Then I'll start WakefullIntentService in onReceive() method. This will feed my WebService in the background. That would work for sending data over HTTP in the background.
... and doubts:
How about updating GPS/"network provided" position data in the background? Should I start some additional service and use LocationListener within it? There would be no sense for using AlarmManager then - I could feed my WebService from this location-monitoring service.
But as I read here: Diamonds Are Forever. Services Are Not. it's not a good practise to play with never-ending services. As I understand it would not work correctly when my phone is sleeping.