Android Bound Services Using Inter Process Communications

Android Service components can be implemented using a number of mechanisms.  If you want your Service to be able to communicate with other applications running in separate processes, using Inter Process Communications (IPC) is one approach.

The diagram below shows the major classes and methods needed in the binding activity and bound service.  The details of this implementation can be found on the Android Developers Web site here on the Bound Services page

In summary, the major classes involved are:

  • Service - Application component for longer-running operations that do not interface directly with the user.
  • ServiceConnection - Interface for monitoring a service.
  • Messenger - Creates a Messenger pointing to a Handler in one process, and handing that Messenger to another process.
  • Message - Description and arbitrary data object that can be sent to a Handler.
  • IBinder - Interface for a remotable object.
  • Handler - allows you to send and process Message and Runnable objects associated with a thread's MessageQueue.