private void showInNotificationBar(
      String title, String ticker, Bitmap iconBitmap, int notificationId, Intent intent) {
    logger.d("notification#showInNotificationBar title:%s ticker:%s", title, ticker);

    NotificationManager notifyMgr =
        (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
    if (notifyMgr == null) {
      return;
    }

    Builder builder = new NotificationCompat.Builder(ctx);
    builder.setContentTitle(title);
    builder.setContentText(ticker);
    builder.setSmallIcon(R.drawable.tt_small_icon);
    builder.setTicker(ticker);
    builder.setWhen(System.currentTimeMillis());
    builder.setAutoCancel(true);

    // this is the content near the right bottom side
    // builder.setContentInfo("content info");

    if (configurationSp.getCfg(
        SysConstant.SETTING_GLOBAL, ConfigurationSp.CfgDimension.VIBRATION)) {
      // delay 0ms, vibrate 200ms, delay 250ms, vibrate 200ms
      long[] vibrate = {0, 200, 250, 200};
      builder.setVibrate(vibrate);
    } else {
      logger.d("notification#setting is not using vibration");
    }

    // sound
    if (configurationSp.getCfg(SysConstant.SETTING_GLOBAL, ConfigurationSp.CfgDimension.SOUND)) {
      builder.setDefaults(Notification.DEFAULT_SOUND);
    } else {
      logger.d("notification#setting is not using sound");
    }
    if (iconBitmap != null) {
      logger.d("notification#fetch icon from network ok");
      builder.setLargeIcon(iconBitmap);
    } else {
      // do nothint ?
    }
    // if MessageActivity is in the background, the system would bring it to
    // the front
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent pendingIntent =
        PendingIntent.getActivity(ctx, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(pendingIntent);
    Notification notification = builder.build();
    notifyMgr.notify(notificationId, notification);
  }
 public void onLoginSuccess() {
   int loginId = IMLoginManager.instance().getLoginId();
   configurationSp = ConfigurationSp.instance(ctx, loginId);
   if (!EventBus.getDefault().isRegistered(inst)) {
     EventBus.getDefault().register(inst);
   }
 }
  private void handleMsgRecv(UnreadEntity entity) {
    logger.d("notification#recv unhandled message");
    int peerId = entity.getPeerId();
    int sessionType = entity.getSessionType();
    logger.d("notification#msg no one handled, peerId:%d, sessionType:%d", peerId, sessionType);

    // 判断是否设定了免打扰
    if (entity.isForbidden()) {
      logger.d("notification#GROUP_STATUS_SHIELD");
      return;
    }

    // PC端是否登陆 取消 【暂时先关闭】
    //        if(IMLoginManager.instance().isPcOnline()){
    //            logger.d("notification#isPcOnline");
    //            return;
    //        }

    // 全局开关
    boolean globallyOnOff =
        configurationSp.getCfg(
            SysConstant.SETTING_GLOBAL, ConfigurationSp.CfgDimension.NOTIFICATION);
    if (globallyOnOff) {
      logger.d("notification#shouldGloballyShowNotification is false, return");
      return;
    }

    // 单独的设置
    boolean singleOnOff =
        configurationSp.getCfg(entity.getSessionKey(), ConfigurationSp.CfgDimension.NOTIFICATION);
    if (singleOnOff) {
      logger.d("notification#shouldShowNotificationBySession is false, return");
      return;
    }

    // if the message is a multi login message which send from another terminal,not need notificate
    // to status bar
    // 判断是否是自己的消息
    if (IMLoginManager.instance().getLoginId() != peerId) {
      showNotification(entity);
    }
  }