private DmDataConnection(Context context) { mContext = context; mConnMgr = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); // register the CONNECTIVITY_ACTION receiver mConnectivityReceiver = new ConnectivityReceiver(); // init DmDatabase mDmDatabase = new DmDatabase(context); if (serviceHandler == null) { if (DmService.getServiceInstance() != null) serviceHandler = DmService.getServiceInstance().mHandler; } IntentFilter intent = new IntentFilter(); intent.addAction(ConnectivityManager.CONNECTIVITY_ACTION); intent.addAction(DmConst.intentAction.NET_DETECT_TIMEOUT); mContext.registerReceiver(mConnectivityReceiver, intent); }
private void notifyHandlers(int msgCode) { clientHandler = null; if (DmClient.getMdmClientInstance() != null) clientHandler = DmClient.getMdmClientInstance().apnConnHandler; // } if (serviceHandler == null) { if (DmService.getServiceInstance() != null) serviceHandler = DmService.getServiceInstance().mHandler; } if (clientHandler != null) { clientHandler.sendMessage(clientHandler.obtainMessage(msgCode)); } if (serviceHandler != null) serviceHandler.sendMessage(serviceHandler.obtainMessage(msgCode)); // extended message handler if (userMsgHandler != null) { userMsgHandler.sendMessage(userMsgHandler.obtainMessage(msgCode)); } }