Reputation: 269
Dear All, I am a newbiew to Android. I had read a lot of articles about Android Service but I am not clearly understanding what defferent between Local Service and Remote Service (except for "Local Service run in the same process as the lunching activity; remote services run in their own process" - The Busy Coder's Guide to Android Development - Mark L. Murphy ).
Thanks & best regards Dai Son
Upvotes: 23
Views: 11849
Reputation: 4917
I hope I can clarify the issue from my own experience:
LocalService:
To be created to serve local applications (activities) by providing background execution or performing some specific software functionality. Not accessible by other applications not in the same package except through intent. Local service normally lives in the same process as the companion activity. But it can potentially have it's own process if needed.
Remote Service
This type of services normally design and implement software functionality to be used by other apps. Android system services (wifi/gps/usb/etc.)are the main examples in this category. If you need provide functionality to be used by other apps, you need to develop a remote service which implements remote binding, intent (through startCommand) or other IPC mechanism.
Remote or local it all depends on your need and application.
More readings:
Android Official Document on service binding.
Cheers,
David.
Upvotes: 0
Reputation: 3234
The difference between remote service and local service is: Local service runs in the same process and remote service runs in different process and may be in different application.
You can access a remote service which is running in the different application but you can't access a local service that is running in a different application.
Upvotes: 2
Reputation: 3234
Local service means it runs in the same process probably in the same application. You can start a service using the method startService()
and you can stop the service by using the method stopService()
. These two life cycle methods or Service And remote service are generally run in a different application. you can access them by writing AIDL Interfaces and you can attach to a remote service by using binder.
Upvotes: 0
Reputation: 48577
Your description is exactly the difference between a local and remote service. There's nothing more to say. You will almost never want to use a remote service.
Upvotes: 9