public void onServiceConnected(ComponentName name, IBinder service) { mBinder = (SPPMirrorServiceBinder) service; if (mBinder != null) { mBinder.onSync(); } else { updateStatus("service connection failed"); } }
public void onConnectLink(View view) { if (mBinder != null) { boolean auto_reconnect = mCheckBoxAutoReconnect.isChecked(); int port = 6800; try { mLastNetPort = mEditTextNetPort.getText().toString(); port = Integer.parseInt(mLastNetPort); } catch (Exception e) { } mLastBluetoothAddress = mBluetoothAddress; mLastAutoReconnect = mCheckBoxAutoReconnect.isChecked(); mBinder.onConnectLink(mBluetoothAddress, port, auto_reconnect); } }
public void onStopService(View view) { if (mBinder != null) { mBinder.onDisconnectLink(); try { updateStatus("service unbinding"); unbindService(this); } catch (Exception e) { /* service may not be running */ } updateStatus("service stopping"); stopService(mIntent); mBinder = null; updateStatus("service stopped"); } }
public void onDisconnectLink(View view) { if (mBinder != null) { mBinder.onDisconnectLink(); } }