How to check if bluetooth is enabled programmatically?

There you go:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
    // Device does not support Bluetooth
} else if (!mBluetoothAdapter.isEnabled()) {
    // Bluetooth is not enabled :)
} else {
    // Bluetooth is enabled 
}

With uses-permission

 <uses-permission android:name="android.permission.BLUETOOTH" android:required="false" />

public boolean isBluetoothEnabled()
    {
        BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        return mBluetoothAdapter.isEnabled();

    }

with the permission in manifest file:

<uses-permission android:name="android.permission.BLUETOOTH" />

Here I have other alternative as an answer for this question.

First add following lines in your Manifest file.

<uses-feature android:name="android.hardware.BLUETOOTH" android:required="false"/>

Now, where you want to check Bluetooth supportability, use following code.

boolean isBluetoothSupported = getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);