Reputation: 37144
I have a mix-case IDL service that I'm using in 2 ways:
So my questions are
Upvotes: 0
Views: 1549
Reputation: 1007494
For scenario #1 what is the price (if any) I'm paying for using service for network calls instead of creating background thread directly in the Activity?
I am assuming that, since you said this is an "IDL service", that this is what I call a remote service -- you are using AIDL to define an interface that is being used across process boundaries.
In that case, the cost is several MB of RAM for the second process, plus a bit of CPU time for the IPC overhead. How much that "bit of CPU time" is depends on how frequently it is called.
For #2 - am I better off changing implementation to AlarmManager?
Generally, yes. Ideally, services are in memory as little as possible.
I noticed that when I kill processes with TasKiller my service dies and never gets restarted, would AlarmManager-base job have better chance of recovery?
No, because "task killer" apps tend to abuse an API (in Dianne Hackborn's words) that will kill off everything, including scheduled alarms. At present, there is no reliable & efficient defense against "task killers" that I am aware of.
Upvotes: 1