Best way to communicate between two applications

Best way to communicate between two applications

communication between apps android
app to app communication
c# communicate between two applications
communication between two apps
android aidl two way communication

I want to create a central application for a suite of applications. The suite of applications are developed by ourselves and third party vendor. We would like to know the best approach to achieve below features

1) Launch the sub application from the central application

The sub applications are installed in the device and package name of sub applications are provided by the vendors.We thought of using explicit intent to invoke the sub application. Any other approach to start the sub applications from central application.

2) Communication between the central and sub Applications.

There is no communication layer for the sub applications. Every communication from the sub applications should be send to server via central application. The communication includes GET, POST, PUT request. We thought of using Broad cast receivers to send the payload to central application. The central application will in turn send the payload to server. But Broadcast receiver restrictions on Android Oreo will make this solution not viable.

3) close sub applications launched from central application when user performs log out in central app.

We are thinking to use killBackgroundProcesses() API provided as part of ActivityManager to kill the process. Any other solution to kill the process ? Any negative impacts in using this API to kill the process ?

4) Publish of events from central application to sub applications to consume.

We thought of broadcast receiver to publish the events from central to sub applications. But as mentioned above Broadcast receiver restrictions on Android Oreo will make this solution not viable. Any alternative solution ?

What you need is Implicit Intents. This way your sub-applications do not need to know implementation details from your central application.

Just create an intent, using a specific action constant that your central application will understand as a command. The central application then decides what REST operation to complete. (I would recommend each of your sub and central applications includes the same library module (effectively an SDK) which will contain the constants)

 //in this example ActionConstants would just be a class with
 //some string constants
 Intent intent = new Intent(ActionConstants.UPDATE_NAME);
 intent.putExtra(ActionConstants.EXTRA_NAME, myNewName);

 public final class ActionConstants {

     public static final String UPDATE_NAME = "";

     private ActionConstants(){}


Your applications presumably are separate APK's which means you may want to check whether the Central application is installed before sending the Intent - this stops your sub applications crashing and gives you the chance to show a dialog (etc.) to the user telling them the action cannot be completed.

PackageManager packageManager = getActivity().getPackageManager();
if (intent.resolveActivity(packageManager) != null) {
    //You can use startBroadcast, or start activity with no UI
} else {
    Log.d(TAG, "Intent not sent");
    //Notify user

In your central application you then want to receive the intent and handle it:

protected void onNewIntent(Intent intent) {
    String action = intent.getAction();
    switch(action) {
        case ActionConstants.UPDATE_NAME:
            if (intent.hasExtra(ActionConstants.EXTRA_NAME)) {
                //TODO: Now you contact the server and carry out your update
            } else {
                //No name supplied, it's an error, maybe broadcast the error back to sub app

For the central application to actually receive the explicit intent, the activity and filter need to be registered in the manifest:

<activity android:name="MyActivity">
        <!-- Note that the action matches the constant we used -->
        <action android:name=""/>
        <category android:name="android.intent.category.DEFAULT"/>

We thought of using Broad cast receivers to send the payload to central application. Broadcast receiver restrictions on Android Oreo will make this solution not viable

Don't worry about this. Use a JobScheduler or even a foreground service from your central app and you'll still be able to communicate in real time, but the implicit intents are a better choice

We are thinking to use killBackgroundProcesses

This isn't a clean approach, instead use another action for an intent, when the sub application receives it, it can finish

We thought of broadcast receiver to publish the events from central to sub applications

Again, a workaround is to have each sub app run a service which context-registers the BC - this could be in your library module so each sub app just runs it - but it is not at all a clean solution. This only matters if the sub apps need to receive the broadcast when in the background. An alternative is to use sticky broadcasts the sub apps can consume when opened.

One final thought - a slightly more complex solution for the interaction between apps would be to have each sub-app send an intent to the central app which contains the string constant for an explicit broadcast receiver (which is declared in the sub-app manifest). The central app then treats this a register event and keeps a list of all those sub-apps to explicitly contact when sending a broadcast. (It just means sending the broadcasts in a loop, to each sub-app in turn)

Best way to communicate between two applications, Cross-app communication in Windows 10 API to make two-way communication between apps possible. Although the inventory app would be the best source for that data, launching the inventory app in this case would  This does not seem ideal - in my mind, there should normally be a pretty clear Client-Server relationship between applications and having this sort of 2 way communication leads to unnecessary complexity. I don't have much knowledge around cross-application communication, but it does seem like WCF is the way to go.

Answering the specific question and not whether your implementation is suitable or not, explicit broadcast intents and receivers in Oreo are untouched, so should work.

Differentiate implicit broadcast receiver vs explicit broadcast receiver in the manifest

Using cross-app communication to make apps work together (10 by , Examples can be provided if you have an idea of which one will suit your needs best. Regards, Russell. Not the solution you were looking for? Getting a  app1.exe is the main application. User gives some command at app1.exe and those commands are transferred to app2.exe for processing. After processing app2.exe will respond to app1.exe.

1 Using Intents is best for calling sub applications.

2 For Communication between applications there exists AIDL although it might look a bit tough to implement but in reality it is very easy it provides a way for you to do inter-process communication in android by providing a very basic interface between applications. Google play services use this to perform In App Payments.

3 You should use account manager for this it will help share the same access token across the application suite and will gracefully handle both login and logout features.

4 This again be done using AIDL.

I also feel that you should revisit architecture of this solution as it seems all your work can be done in a single application and there seems no use to create such elaborate application design.

Communication between two applications (On the same machine , This lesson shows how to use sockets to allow to LiveCode apps to talk to Once two machines are connected, they can then communicate streams of There are a range of transport layers that can be used on top of IP. These nine business communication apps, available on mobile devices and desktop computers, provide a reliable and versatile way for employees to communicate effectively with one another: 1) Slack Slack has quickly become one of the most popular project management and collaboration tools, especially for companies with remote workers.


Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
if (launchIntent != null) { 
    startActivity(launchIntent);//null pointer check in case package name was not found

2) Try giving a look at content providers

How to communicate with other applications using sockets, It's important to understand what each of these components do so you can craft the best solution to your problem. One app can tell if another Continue Reading​. The usual mechanism for sharing data between apps is with a ContentProvider. One app can essentially expose its data/database to another by querying a ContentProvider exposed by the app that contains the interesting data. There are detailed docs on using ContentProvider.

It's better to implement a messaging library like CometD. if you want to control and monitor activities of client applications and users from a central application. we can use the client application states like user session active, inactive, timeouts,block or unblock and send information like push notification,messaging etc. everything can be done with commetD.

How to make two separate Android apps to communicate, Communicating between Apps is one of the important factor that developers needs to take care of. This could be done via some services  Only way to communicate with it is to use the Windows messaging system through Win32 API, send the calculator some key stroke events, including "Ctrl-C" at the end and grab the result from the clipboard.

Inter App Communication, Android Inter-Process Communication At the simplest level there are two different ways for apps to interact on Android: via Intents, pass. We would like to show you a description here but the site won’t allow us.

Communicating Between Android Apps, In short Developer of app B is providing its sdk to developer of app A which when used Hi Shri-Tam you can try Real-Time Communication with Streams Most problems like this don't have a good solution because iOS  SignalR is a good way to achieve real-time communication for pushing content to the clients from a back-end server. Since communication is in real time, client apps show the changes almost instantly. This is usually handled by a protocol such as WebSockets, using many WebSockets connections (one per client).

How to communicate between two apps? |Apple Developer Forums, An app can support the Share feature in two ways. In addition to communication between UWP apps, these methods also support sharing to  Apart from the above three ways of communicating online, you can also use audio conferencing to communicate online with your family members, friends, business partners and students. Basically, it is a connection between two computers equipped with speakers and microphones. Participants use either an audio conferencing application such as Skype