コード例 #1
0
  @Override
  protected void onStart() {
    super.onStart();

    // Check Bluetooth availability on the device and set up the Bluetooth adapter
    bluetoothSerial.setup();
  }
コード例 #2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
      case REQUEST_ENABLE_BLUETOOTH:
        // Set up Bluetooth serial port when Bluetooth adapter is turned on
        if (resultCode == Activity.RESULT_OK) {
          bluetoothSerial.setup();
        }
        break;
    }
  }