@Override public void onServiceConnected(ComponentName name, IBinder service) { // TODO Auto-generated method stub mSocketService = (ILCSocketService) (((BinderServicePolice) service).getService()); mSocketService.addSocketServiceConnectListen(LCActionbarActivity.this); mSocketService.addReceiveDataListen(LCActionbarActivity.this); mSocketService.addOnSocketSendDataSuccessListen(LCActionbarActivity.this); mSocketService.ConnectByAuto(); }
protected void destroyService() { if (mSocketService != null) { mSocketService.removeSocketServiceConnectListen(this); mSocketService.removeReceiveDataListen(this); } if (isBind) { getApplicationContext().unbindService(mServiceConnection); isBind = false; } }