private int beginDmDataConnectivityGemini(int simId) throws IOException {

    int result =
        MTKConnectivity.startUsingNetworkFeatureGemini(
            mConnMgr, ConnectivityManager.TYPE_MOBILE, MTKPhone.FEATURE_ENABLE_DM, simId);

    Log.i(
        TAG.Connection, "startDmDataConnectivityGemini: simId = " + simId + "\t result=" + result);

    if (result == MTKPhone.APN_ALREADY_ACTIVE) {
      Log.w(TAG.Connection, "The data connection is already exist, go ahead");
      ScreenLock.releaseWakeLock(mContext);
      ScreenLock.acquirePartialWakelock(mContext);
      ensureRouteToHost();
    } else if (result == MTKPhone.APN_REQUEST_STARTED) {
      Log.w(
          TAG.Connection, "The new data connection is started register and waiting for the intent");
      ScreenLock.releaseWakeLock(mContext);
      ScreenLock.acquirePartialWakelock(mContext);
      // mContext.registerReceiver(mConnectivityReceiver, new
      // IntentFilter(
      // ConnectivityManager.CONNECTIVITY_ACTION));
      // mContext.registerReceiver(mConnectivityReceiver, new
      // IntentFilter(DmConst.intentAction.NET_DETECT_TIMEOUT));
      // mTelephonyManager=(TelephonyManager)
      // mContext.getSystemService(Service.TELEPHONY_SERVICE);
    } else if (result == MTKPhone.APN_REQUEST_FAILED) {
      Log.e(TAG.Connection, "startUsingnetworkfeature failed");
    } else {
      throw new IOException("Cannot establish Dm Data connectivity");
    }
    return result;
  }
  // add for gemini
  private void endDmConnectivityGemini(int simId) {
    try {
      Log.i(TAG.Connection, "endDmDataConnectivityGemini: simId = " + simId);

      if (mConnMgr != null) {
        MTKConnectivity.stopUsingNetworkFeatureGemini(
            mConnMgr, ConnectivityManager.TYPE_MOBILE, MTKPhone.FEATURE_ENABLE_DM, simId);
      }
    } finally {
      Log.v(TAG.Connection, "stopUsingNetworkFeature end");
    }
  }
    @Override
    public void onReceive(Context context, Intent intent) {
      if (context == null || intent == null) return;
      if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
        Log.d(TAG.Connection, "ConnectivityReceiver Receive android.net.conn.CONNECTIVITY_CHANGE");
        Bundle mBdl = intent.getExtras();
        if (mBdl != null) {
          NetworkInfo info = (NetworkInfo) mBdl.get(ConnectivityManager.EXTRA_NETWORK_INFO);
          if (info == null) {
            Log.e(TAG.Connection, "[dm-conn]->Get NetworkInfo error");
            return;
          }
          simId = DmCommomFun.getSimRegisterID(mContext);
          if (simId == -1) {
            Log.e(TAG.Connection, "[dm-conn]->Get Register SIM ID error in connetivity receiver");
            return;
          }
          int networkSimId = MTKConnectivity.getSimId(info);
          int intentSimId = intent.getIntExtra(MTKConnectivity.EXTRA_SIM_ID, 0);
          int networkType = info.getType();

          if (intentSimId == simId && networkType == MTKConnectivity.TYPE_MOBILE_DM) {
            Log.i(
                TAG.Connection,
                "[dm-conn]->type == " + info.getTypeName() + "(" + networkType + ")");
            Log.i(TAG.Connection, "[dm-conn]->intent_sim_Id == " + intentSimId);
            Log.i(TAG.Connection, "[dm-conn]->network_sim_Id == " + networkSimId);
            Log.i(TAG.Connection, "[dm-conn]->registered_sim_Id == " + simId);

            State state = info.getState();
            if (state == State.CONNECTED) {
              Log.i(TAG.Connection, "[dm-conn]->state == CONNECTED");
              try {
                ensureRouteToHost();

                // store CONNECTED event.
                DmApplication.getInstance().queueEvent(SessionEventQueue.EVENT_CONN_CONNECTED);
                Log.i(TAG.Connection, ">>sending msg WAP_CONN_SUCCESS");
                notifyHandlers(IDmPersistentValues.MSG_WAP_CONNECTION_SUCCESS);

              } catch (Exception ex) {
                Log.e(TAG.Connection, "[dm-conn]->ensureRouteToHost() failed:", ex);
              }
            } else if (state == State.CONNECTING) {
              Log.i(TAG.Connection, "[dm-conn]->state == CONNECTING");
              return;
            } else if (state == State.DISCONNECTED) {
              Log.i(TAG.Connection, "[dm-conn]->state == DISCONNECTED");

              // store DISCONNECTED event.
              DmApplication.getInstance().queueEvent(SessionEventQueue.EVENT_CONN_DISCONNECTED);
              return;
            }
          }
        }
      } else if (intent.getAction().equalsIgnoreCase(DmConst.intentAction.NET_DETECT_TIMEOUT)) {
        Log.i(TAG.Connection, "[dm-conn]->action == com.mediatek.MediatekDM.NETDETECTTIMEOUT");

        Log.i(TAG.Connection, ">>>sending msg WAP_CONN_TIMEOUT");
        notifyHandlers(IDmPersistentValues.MSG_WAP_CONNECTION_TIMEOUT);
      }
    } // onReceive