is Bluetooth Enabled - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth Enable

Description

is Bluetooth Enabled

Demo Code

import android.bluetooth.BluetoothAdapter;

public class Main {

  static boolean isBluetoothEnabled() {
    return doesDeviceHasBluetooth() && getBluetoothAdapter().isEnabled();
  }//from   ww w  .  j  ava 2 s.c  om

  static boolean doesDeviceHasBluetooth() {
    return getBluetoothAdapter() != null;
  }

  static BluetoothAdapter getBluetoothAdapter() {
    return BluetoothAdapter.getDefaultAdapter();
  }

}

Related Tutorials