Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android check if bluetooth exist on the device

Tags:

android

Is there any way to check is a device has a bluetooth adapter or not? I have a tablet that not has a bluetooth. So how can I handle that?

like image 615
lacas Avatar asked Oct 07 '14 11:10

lacas


1 Answers

Add permission to Manifest

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

Code for Activity

BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter == null) {
    //handle the case where device doesn't support Bluetooth
}
else
{
    //bluetooth supported
}
like image 80
Utpal Sharma Avatar answered Sep 28 '22 22:09

Utpal Sharma