Пример #1
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   switch (requestCode) {
     case Globals.REQUEST_CONNECT_DEVICE:
       if (resultCode == Activity.RESULT_OK) {
         address = data.getExtras().getString(Globals.EXTRA_DEVICE_ADDRESS);
         BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
         mBluetoothService.connect(device);
       }
     case Globals.REQUEST_ENABLE_BT:
       if (resultCode == Activity.RESULT_OK) {
         setupConfigurations();
       } else {
         Log.d(Globals.TAG, "BT not enabled");
         Toast.makeText(this, R.string.bt_not_enabled_leaving, Toast.LENGTH_SHORT).show();
         finish();
       }
       break;
   }
 }
Пример #2
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mBluetoothService != null) mBluetoothService.stop();
 }