예제 #1
0
 private void initBluetoothUtil() {
   Log.v(TAG, "BlueToothUtil Init");
   bluetoothUtil = new BluetoothUtil(this, mainHandler);
   if (bluetoothUtil.isBluetoothEnabled()) {
     bluetoothUtil.openServer();
   }
 }
예제 #2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    int REQUEST_DISCOVERALBLE_BT = 1;

    if (requestCode == REQUEST_DISCOVERALBLE_BT) {
      if (bluetoothUtil.isBluetoothEnabled()) {
        bluetoothUtil.openServer();
      } else {
        // open bluetooth failed
        Toast.makeText(MainActivity.this, "蓝牙开启失败", Toast.LENGTH_SHORT).show();
      }
    }
  }
예제 #3
0
 private void destroyBluetoothUtil() {
   bluetoothUtil.destroy();
 }