How to implement binder services, when client applications are in different p rocesses?

Answer: 
Binder is used if both client and server are in same application.

If client and service (server) are in different applications, then this can be implemented in two ways:


1. Messenger - is a simple way to implement binder service, which is single threaded mode.
With this, your service can handle only one client request at a time.


2. aidl (Android interface definition language) - use it if you want multi threaded capability for your server/service.
With this, your service can handle multiple requests at a time. But little complicated.
Make sure that you are writing always thread safe program in your service when using with aidls.
This is not recommended for most of the implementations.

No comments:

Post a Comment