get Bluetooth Scanning Device - Android Bluetooth

Android examples for Bluetooth:Bluetooth Device

Description

get Bluetooth Scanning Device

Demo Code


//package com.java2s;

import java.util.List;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;

import android.content.Context;

public class Main {
    public static List<BluetoothDevice> theScanningBluetoothDevice = null;

    public static List<BluetoothDevice> getScanningDevice(Context context) {
        if (isThisMahionSupportBluetooth() && isBluetoothHadOpen()
                && theScanningBluetoothDevice != null) {
            return theScanningBluetoothDevice;
        }/*  ww w  .  ja va 2 s . c o  m*/
        return null;
    }

    public static boolean isThisMahionSupportBluetooth() {
        BluetoothAdapter ba = BluetoothAdapter.getDefaultAdapter();
        if (null != ba) {
            return true;
        }
        return false;
    }

    public static boolean isBluetoothHadOpen() {
        if (isThisMahionSupportBluetooth()) {
            BluetoothAdapter ba = BluetoothAdapter.getDefaultAdapter();
            if (ba.isEnabled()) {
                return true;
            }
        }
        return false;
    }
}

Related Tutorials