Skip to main content
Communicating between Android apps

This post is from the Apperian blog and has not been updated since the original publish date.

Last Updated Apr 29, 2015 — App Management expert

Communicating between Android apps

The definitive guideto mobile application management

This guide explains how to leverage a mobile application management platform for mobile app distribution, security, and lifecycle management to achieve the highest rates of app adoption and ROI.

Download a copy
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.

More from the Blog

View more
Apr 30, 2020

Mobile Application Management: A Forward View

App Management
  IT Is Adapting in the Midst of the COVID-19 Pandemic The Coron ...
Read More
May 19, 2019

Sneak Peek: How Are IT Leaders Driving Mobile App Adoption?

App Management
Apperian conducted the The Mobile Enterprise Application Survey to fin ...
Read More
Jan 30, 2019

Part 1: App Security Should Be an Integral Part of Your DevSecOps Process — Not an Afterthought

Application Security
What are the key considerations and components of DevSecOps? The in ...
Read More
Nov 19, 2018

Breaking Down the New California IoT Law

Application Security
Recently California passed legislation regarding the security of all I ...
Read More
Contact Us