public class BluetoothLeScannerCompatProvider
extends java.lang.Object
BluetoothLeScannerCompat
which will use the Android "L" APIs if they are present,
which can leverage the newest BLE hardware; or if running on an older version of the OS,
this provider falls back to providing a CPU-bound BLE scanner which has the same feature set.
A BluetoothLeScannerCompat
allows the application to register for callback events for
advertising packets broadcast from Bluetooth LE devices.Modifier and Type | Method and Description |
---|---|
static BluetoothLeScannerCompat |
getBluetoothLeScannerCompat(android.content.Context context)
Creates a
BluetoothLeScannerCompat that works with the version of Android being used. |
static BluetoothLeScannerCompat |
getBluetoothLeScannerCompat(android.content.Context context,
boolean canUseNativeApi)
Creates a
BluetoothLeScannerCompat , providing either a compatibility layer or
access to native functionality available in "L". |
public static BluetoothLeScannerCompat getBluetoothLeScannerCompat(android.content.Context context)
BluetoothLeScannerCompat
that works with the version of Android being used.
For Android versions between Jelly Bean MR2 and "L", a compatibility layer will be used to
provide functionality that will be available in "L". For Android versions "L" and later, the
native functionality will be used.context
- The Android context of the application.BluetoothLeScannerCompat
best fitting the version of Android. If no scanner
can be found, null will be returned.public static BluetoothLeScannerCompat getBluetoothLeScannerCompat(android.content.Context context, boolean canUseNativeApi)
BluetoothLeScannerCompat
, providing either a compatibility layer or
access to native functionality available in "L".
context
- The Android context of the application.canUseNativeApi
- Whether or not to enable "L" hardware support, if available.BluetoothLeScannerCompat
. If no scanner can be found, null will be returned.