private void initBluetoothUtil() { Log.v(TAG, "BlueToothUtil Init"); bluetoothUtil = new BluetoothUtil(this, mainHandler); if (bluetoothUtil.isBluetoothEnabled()) { bluetoothUtil.openServer(); } }
@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(); } } }
private void destroyBluetoothUtil() { bluetoothUtil.destroy(); }