start bluetooth Scanning - Android Phone

Android examples for Phone:Bluetooth

Description

start bluetooth Scanning

Demo Code


//package com.java2s;

import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;

import android.bluetooth.le.ScanSettings;

public class Main {
    public static void startScanning(BluetoothLeScanner scanner,
            ScanCallback callback) {/*from w w w  .ja va2 s .c  om*/
        ScanSettings settings = new ScanSettings.Builder().setScanMode(
                ScanSettings.SCAN_MODE_BALANCED).build();
        scanner.startScan(null, settings, callback);
    }
}

Related Tutorials