is bluetooth device Discoverable - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth

Description

is bluetooth device Discoverable

Demo Code

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.text.TextUtils;
import java.util.Locale;

public class Main{


    public static boolean isDiscoverable() {
        BluetoothAdapter bluetoothDefaultAdapter = BluetoothAdapter
                .getDefaultAdapter();/*www .ja v a2 s .c o  m*/
        if ((bluetoothDefaultAdapter != null)
                && (bluetoothDefaultAdapter.isEnabled())) {
            if (bluetoothDefaultAdapter.getScanMode() == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE)
                return true;
        }
        return false;
    }

}

Related Tutorials