Example usage for android.bluetooth.le ScanSettings CALLBACK_TYPE_ALL_MATCHES

List of usage examples for android.bluetooth.le ScanSettings CALLBACK_TYPE_ALL_MATCHES

Introduction

In this page you can find the example usage for android.bluetooth.le ScanSettings CALLBACK_TYPE_ALL_MATCHES.

Prototype

int CALLBACK_TYPE_ALL_MATCHES

To view the source code for android.bluetooth.le ScanSettings CALLBACK_TYPE_ALL_MATCHES.

Click Source Link

Document

Trigger a callback for every Bluetooth advertisement found that matches the filter criteria.

Usage

From source file:au.com.smarttrace.beacons.BluetoothService.java

/** Init bluetooth adapter */
private void initBluetooth() {
    if (btManager == null)
        btManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
    btAdapter = btManager.getAdapter();//from   www . j  a va 2s.co m

    ScanSettings.Builder builder = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_BALANCED)
            .setReportDelay(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        builder.setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES);
    btSettings = builder.build();

    btFilters = new ArrayList<>();
}