android – Remote Service Vs. Local Service-ThrowExceptions

Exception or error:

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 ).

  1. Please shows me what different between Local Service and Remote Service.
  2. What’s the advantage/disadvantage of using Local Service.
  3. What’s the advantage/disadvantage of using Remote Service.

Thanks & best regards
Dai Son

How to solve:

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.

###

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.

###

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.

###

I think you are really newbiew, and me too ^^. but I explain as well as i know.

a local service communicates with your activity through process memory. this is fast and simple. but you can not implement multi-process program like plug-in with the local service.

but remote service can communicates with other process. so you can make programs like plug-in. but it is not fast so much(but enough maybe). because you ask to OS “I want communication with ….”. and this happens through file system(Pipe) or kernel memory(Binder)… variable routes,

so this is not fast because read file or traffic with other processes coummucations.

Leave a Reply

Your email address will not be published. Required fields are marked *