PLEASE NOTE: This course was retired on
24 Jan 2019. This means
it is no longer being updated or maintained, so information within the
course may no longer be accurate. FutureLearn accepts no liability for any
loss or damage arising as a result of use or reliance on this information.

Introduction to Interprocess Communication (IPC)

In this section, we introduce you to how to secure asynchronous and synchronous Interprocess Communication (IPC) in Android. In two exercises, you will also be encouraged to identify inadequate permissions using BuggyTheApp.

In software systems it is often the case that different processes need to communicate with one another in order to cooperate on some task. This is known as Interprocess Communication (IPC), and over the years many different mechanisms have been employed in order to perform IPC.

Android provides its own mechanisms for IPC, but it should be noted here that the name IPC is a bit of a misnomer on Android, as the Android IPC mechanisms are designed to operate at the level of components rather than processes. In other words a component in one app may use IPC to communicate with a component in another app, or with another component in the same app. Thus IPC in Android is a bit more general than the name would imply.

Asynchronous and Synchronous IPC

In general IPC can take one of two forms:

Asynchronous: with asynchronous IPC the sender does not wait for the receiver to receive the message. The send function or method returns immediately, and then sometime later the receiver receives the message. If the message requires a response from the receiver, then the message may supply details of how the receiver can send a reply to the sender.

Synchronous: with synchronous IPC the send and receive are synchronised, and often from the receiver’s perspective it appears like a normal method or function call, with any response from the receiver passed to the sender as the return value from the send function or method. With synchronous IPC, if the receiver is slow responding to the message the sender will block until the receiver responds. This is often undesirable in user interface components.

Android provides both asynchronous and synchronous IPC.

Note for Nerds: as Android under the hood runs on Linux, the traditional Linux mechanisms for IPC like network sockets and shared files are available, but their use for app development is discouraged.