private void init2cu() { DataManager.findAlarmMaskByActiveUser(PreMainActivity.this, ""); NpcCommon.verifyNetwork(PreMainActivity.this); regFilter(); if (!verifyLogin()) { String accountstr = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "account"); String pwd2cu = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "pwd2cu"); loginVideo("newyywapp" + accountstr + "@yywapp.com", pwd2cu); } else { FList.getInstance(); P2PHandler.getInstance().p2pInit(this, new P2PListener(), new SettingListener()); connect(); getAccountInfo(); } }
@Override public void onReceive(Context arg0, Intent intent) { // TODO Auto-generated method stub if (intent.getAction().equals(Constants.Action.ACTION_NETWORK_CHANGE)) { boolean isNetConnect = false; ConnectivityManager connectivityManager = (ConnectivityManager) PreMainActivity.this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetInfo != null) { if (activeNetInfo.isConnected()) { isNetConnect = true; LogMgr.showLog( "mReceiver==>" + getResources().getString(R.string.os_message_net_connect)); } else { LogMgr.showLog( "mReceiver==>" + getResources().getString(R.string.os_network_error)); } if (activeNetInfo.getType() == ConnectivityManager.TYPE_WIFI) { NpcCommon.mNetWorkType = NETWORK_TYPE.NETWORK_WIFI; } else { NpcCommon.mNetWorkType = NETWORK_TYPE.NETWORK_2GOR3G; } } else { LogMgr.showLog("mReceiver==>" + getResources().getString(R.string.os_network_error)); } NpcCommon.setNetWorkState(isNetConnect); Intent intentNew = new Intent(); intentNew.setAction(Constants.Action.NET_WORK_TYPE_CHANGE); PreMainActivity.this.sendBroadcast(intentNew); } else if (intent.getAction().equals(Constants.Action.ACTION_SWITCH_USER)) { Account account = AccountPersist.getInstance().getActiveAccountInfo(PreMainActivity.this); exitConn(account); AccountPersist.getInstance().setActiveAccount(PreMainActivity.this, new Account()); NpcCommon.mThreeNum = ""; Intent i = new Intent(MyApp.MAIN_SERVICE_START); stopService(i); String accountstr = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "account"); String pwd2cu = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "pwd2cu"); loginVideo("newyywapp" + accountstr + "@yywapp.com", pwd2cu); } else if (intent.getAction().equals(Constants.Action.SESSION_ID_ERROR)) { Account account = AccountPersist.getInstance().getActiveAccountInfo(PreMainActivity.this); exitConn(account); AccountPersist.getInstance().setActiveAccount(PreMainActivity.this, new Account()); Intent i = new Intent(MyApp.MAIN_SERVICE_START); stopService(i); String accountstr = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "account"); String pwd2cu = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "pwd2cu"); loginVideo("newyywapp" + accountstr + "@yywapp.com", pwd2cu); } else if (intent.getAction().equals(Constants.Action.ACTION_EXIT)) { /** 屏蔽退出确认弹出框 */ } else if (intent.getAction().equals(Intent.ACTION_LOCALE_CHANGED)) { } else if (intent.getAction().equals(Constants.Action.RECEIVE_MSG)) { /** 暂时屏蔽接收消息 */ /* * int result = intent.getIntExtra("result", -1); String msgFlag * = intent.getStringExtra("msgFlag"); * if(result==Constants.P2P_SET.ACK_RESULT.ACK_SUCCESS){ * DataManager.updateMessageStateByFlag(MainActivity.this, * msgFlag, Constants.MessageType.SEND_SUCCESS); Intent refresh * = new Intent(); * refresh.setAction(MessageActivity.REFRESH_MESSAGE); * sendBroadcast(refresh); }else{ * DataManager.updateMessageStateByFlag(MainActivity.this, * msgFlag, Constants.MessageType.SEND_FAULT); Intent refresh = * new Intent(); * refresh.setAction(MessageActivity.REFRESH_MESSAGE); * sendBroadcast(refresh); } */ } else if (intent.getAction().equals(Constants.Action.RECEIVE_SYS_MSG)) { } else if (intent.getAction().equals(Constants.Action.ACTION_UPDATE)) { /** 检测更新屏蔽 */ } }