code: @Override
      public void onReceive(Context context, Intent intent) {
          // display errors to the user
          Bundle bundle = intent.getExtras();
          if (intent.getAction().equals(DDPStateSingleton.MESSAGE_ERROR)) {
              String message = bundle
                      .getString(DDPStateSingleton.MESSAGE_EXTRA_MSG);
              onError("Login Error", message);
          } else if (intent.getAction().equals(
                  DDPStateSingleton.MESSAGE_CONNECTION)) {
              int state = bundle.getInt(DDPStateSingleton.MESSAGE_EXTRA_STATE);
              if (state == DDPStateSingleton.DDPSTATE.Closed.ordinal()) {
                  // connection was closed, show error message
                  onError("Disconnected",
                          "Websocket to server was closed");
              } else if (state == DDPStateSingleton.DDPSTATE.Connected.ordinal()) {
                  onDDPConnect(mDDP);
              } else if (state == DDPStateSingleton.DDPSTATE.LoggedIn.ordinal()) {
                  onLogin();
              } else if (state == DDPStateSingleton.DDPSTATE.NotLoggedIn.ordinal()) {
                  onLogout();
              }
          } else if (intent.getAction().equals(
                  DDPStateSingleton.MESSAGE_SUBUPDATED)) {
              String subscriptionName = bundle
                      .getString(DDPStateSingleton.MESSAGE_EXTRA_SUBNAME);
              String changeType =
              bundle.getString(DDPStateSingleton.MESSAGE_EXTRA_CHANGETYPE);
              String docId = bundle.getString(DDPStateSingleton.MESSAGE_EXTRA_CHANGEID);
              onSubscriptionUpdate(changeType, subscriptionName, docId);
          }
      }
docs: Handles receiving Android broadcast messages
  @param context Android context
  @param intent Android intent