There is an IPC EventBus option which allows you to send events over IPC. https://github.com/NewtronLabs/IpcEventBus
According to the documentation all you have to do to get an event is this:
public class Listener implements IIpcEventBusConnectionListener, IIpcEventBusObserver {
public Listener() {
String targetApp = "com.packagename";
IIpcEventBusConnector connector =
ConnectorFactory.getInstance().buildConnector(context, this, targetApp);
connector.startConnection();
}
@Override
public void onConnected(IIpcEventBusConnector connector) {
connector.registerObserver(this);
}
@Override
public void onEvent(IEventIpc event) {
Log.d("ipceventbus", "Received event: " + event.getClass());
}
@Override
public void onDisconnected(IIpcEventBusConnector connector) {
}
}
And on the other side you post the event like this:
IpcEventBus.getInstance().postEvent(new MyEvent());
I created a two apps and they were able to send events to each other.