private void initPingListener() {
   ChatPingAlarmManager.onCreate(this);
   ChatPingAlarmManager.getInstanceFor()
       .addPingListener(
           new PingFailedListener() {
             @Override
             public void pingFailed() {
               showToast("Ping chat server failed");
             }
           });
 }
  private void logoutSession() {
    try {
      DataHolder.setLoggedUser(null);
      QBRTCClient.getInstance(this).destroy();

      // comment if you haven't started ping alarm
      ChatPingAlarmManager.onDestroy();
      QBChatService.getInstance().logout();
    } catch (SmackException.NotConnectedException e) {
      e.printStackTrace();
    }
  }