예제 #1
0
  public XmppManager getChatManager() {
    if (null != notificationService) {
      return notificationService.getChatManager();

    } else {
      // String username = Preferences.getUserName(Application.sharePref);
      // loginChatClient(username, username);
      Log.e(
          "notificationService====",
          "notificationServiceConnection=" + notificationServiceConnection);
      Log.e("notificationService====", "BeforeBindnotificationService=" + notificationService);

      this.bindService(
          NotificationService.getIntent(this),
          notificationServiceConnection,
          Context.BIND_AUTO_CREATE);
      loginXmppClient(
          Preferences.getUserName(Application.sharePref),
          Preferences.getUserName(Application.sharePref),
          notificationService.getChatManager());
      Log.e("notificationService====", "AffterBindnotificationService=" + notificationService);
      if (notificationService != null) {
        return notificationService.getChatManager();
      }
      return null;
    }
  }