1.Bluetoothをオンにする
<uses-permission android:name="android.permission.BLUETOOTH"/> //Bluetooth を使用するために必要な権限 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> //Bluetooth 権限のスキャンと設定を使用します(この権限を宣言するには、上記の権限を宣言する必要があります)
プライベート BluetoothAdapter mBluetooth;
mBluetooth = BluetoothAdapter.getDefaultAdapter(); //Bluetooth アダプターを取得します
if(!mBluetooth.isEnabled()) { mBluetooth.enable(); } Toast.makeText(MainActivity.this,"正常に開きました", Toast.LENGTH_SHORT).show();
if(mBluetooth.isEnabled()) { mBluetooth.disable(); } Toast.makeText(MainActivity.this,"正常に終了しました", Toast.LENGTH_SHORT).show();