@ RequiresPermission ( Manifest . permission . BLUETOOTH ) static void checkAdapterStateOn ( @ Nullable final BluetoothAdapter adapter ) { if ( adapter == null || adapter . getState ( ) != BluetoothAdapter . STATE_ON ) { throw new IllegalStateException ( "BT Adapter is not turned ON" ) ; } }
Ensure Bluetooth is turned on .