Пример #1
0
 public void onServiceConnected(ComponentName name, IBinder service) {
   mBinder = (SPPMirrorServiceBinder) service;
   if (mBinder != null) {
     mBinder.onSync();
   } else {
     updateStatus("service connection failed");
   }
 }
Пример #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);
   }
 }
Пример #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");
    }
  }
Пример #4
0
 public void onDisconnectLink(View view) {
   if (mBinder != null) {
     mBinder.onDisconnectLink();
   }
 }