Table of Contents

Last Updated Apr 29, 2015 — App Management expert
App Management

Android inter-process communication

At the simplest level, there are two different ways for apps to interact on Android: via intents, passing data from one application to another; and through services, where one application provides functionality for others to use. There are different ways to utilize both methods, depending on what you want to accomplish and what technical challenges you face. This is a brief overview and I will avoid delving into the technical aspects.

Intents

An intent describes an action to be performed, such as opening a file, dialing a phone number, or turning on airplane mode. The first two are actions that can be initiated by user apps, while the latter is a system-wide notification that any app can act on. For example, if you tap on a PDF in a file browser it will probably try to start up a document viewer app so you can read it. In this case, the file browser is using an intent to start an activity to view the file and passing the path to the file as part of the intent’s data. The system receives the intent and opens a different app that has registered with the system that it can view PDF files—or if you have multiple apps that are capable, you might be presented with a list to choose from. Additionally, should an app want to run an action in the background rather than requiring any user interaction, an intent can instead be used to start a service rather than an activity. Any app can also utilize broadcast receivers, which will listen to system-wide messages. An app might want stop trying to connect to the internet once airplane mode is engaged, so by registering a broadcast receiver with the system to listen for an intent with that specific action, the app can tell when it happens and act on it. Intents can also carry extra data via a bundle, which can handle any kind of serializable data. As the data in a bundle is stored using arbitrary keys, this is generally only useful if the receiving app knows the context for the incoming data.

Services

One feature of a service is to perform an action in the background as mentioned above, similar to an activity but without user interface components. The other primary use of a service is to provide bindings, which lets an app expose part of its functionality to other applications. Other apps bound to the service will have a persistent connection that lets them call methods defined on the service, which can directly interact with other parts of the app. Using an example app that controls a VPN connection on the device, a service provided by the app could allow other applications to get information about the VPN connection, its current state, or even turn the connection on or off. While toggling the connection could also be handled by a simple intent action, having access to the other information provided by the service can allow apps to intelligently interact with it.

Learn more about Digital.ai App Management

Are you ready to scale your enterprise?

Explore

What's New In The World of Digital.ai

August 14, 2023

Streamlining Application Development and Deployment for the Financial Services Industry

Enhance financial services with tailored strategies: secure apps, testing, efficient release & monitoring. Read on to learn more!

Learn More
June 23, 2023

Governance and Compliance for DevOps at Scale

Implement a Software Chain of Custody in DevOps for compliance, traceability, and cost reduction. Gain visibility and automate processes with Digital.ai Release & Deploy.

Learn More
April 29, 2015

Communicating between Android apps

Android inter-process communication. At the simplest level, there are two different ways for apps to interact on Android.

Learn More