Ejemplo n.º 1
0
  private void createAdapter() {
    System.setProperty("smack.debugEnabled", "" + mConfig.smackdebug);
    try {
      mSmackable = new SmackableImp(mConfig, getContentResolver(), this);
    } catch (NullPointerException e) {
      e.printStackTrace();
    }

    mSmackable.registerCallback(
        new XMPPServiceCallback() {

          public void newMessage(String from, String message) {
            logInfo("notification: " + from);
            notifyClient(from, mSmackable.getNameForJID(from), message, !mIsBoundTo.contains(from));
          }

          public void rosterChanged() {
            postRosterChanged();
          }

          public void disconnectOnError() {
            logInfo("Smackable disconnected on error");
            postConnectionFailed(getString(R.string.conn_disconnected));
          }

          public boolean isBoundTo(String jabberID) {
            return mIsBoundTo.contains(jabberID);
          }
        });
  }