Blue Nite
Blue Nite

Reputation: 118

How to post an event using IPC EventBus?

I am following the answer on this post IPC in Android using GreenRobot eventbus about IPCEventBus.

public class Listener implements IIpcEventBusConnectionListener, IIpcEventBusObserver {

    public Listener() {
        IIpcEventBusConnector connector =
            ConnectorFactory.getInstance().buildConnector(context, this, "com.blueengine.login");
        connector.startConnection();
    }

    @Override
    public void onConnected(IIpcEventBusConnector connector) {
        connector.registerObserver(this);
    }

    @Override
    public void onEvent(IEventIpc event) {

    }

    @Override
    public void onDisconnected(IIpcEventBusConnector connector) {

    }
}

Then on my Login app

I want to send an event called UserLoggin. How do I do this?

public class UserLoggin implements IEventIpc
{
}

Upvotes: 0

Views: 298

Answers (1)

sam_c
sam_c

Reputation: 810

When your event triggers post the event by calling this:

IpcEventBus.getInstance().postEvent(event);

As outlined in the documentation.

Upvotes: 3

Related Questions