Android で Bluetooth との通信を行う前に、Bluetooth が有効にされているかをチェックする。
BluetoothManager bluetoothManager = (BluetoothManager)getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter bluetoothAdapter = bluetoothManager.getAdapter();
if (bluetoothAdapter == null) {
// TODO: 端末がBLEに対応していない時の処理
} else if (!bluetoothAdapter.isEnabled()) {
// TODO: 端末でBLEが有効にされていない時の処理
}