Checks if the bluetooth adapter is on and ready. - Android Bluetooth

Android examples for Bluetooth:Turn On bluetooth

Description

Checks if the bluetooth adapter is on and ready.

Demo Code


//package com.java2s;

import android.bluetooth.BluetoothAdapter;

public class Main {
    /**//from w  ww .  ja va 2  s  .c  o m
     * Checks if the bluetooth adapter is on and ready.
     */
    public static boolean isBluetoothAvailable() {
        BluetoothAdapter tempBtAdapter = BluetoothAdapter
                .getDefaultAdapter();
        return tempBtAdapter != null && tempBtAdapter.isEnabled();
    }
}

Related Tutorials