@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