Exemplo n.º 1
0
 public void onServiceConnected(ComponentName name, IBinder service) {
   mBinder = (SPPMirrorServiceBinder) service;
   if (mBinder != null) {
     mBinder.onSync();
   } else {
     updateStatus("service connection failed");
   }
 }
Exemplo n.º 2
0
 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);
   }
 }
Exemplo n.º 3
0
  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");
    }
  }
Exemplo n.º 4
0
 public void onDisconnectLink(View view) {
   if (mBinder != null) {
     mBinder.onDisconnectLink();
   }
 }