I am following the documentation for low energy Bluetooth devices for scanning BLE devices.
As mentioned in the document, I defined ---
BluetoothAdapter mBluetoothAdapter = null;
final BluetoothManager bluetoothManager =
(BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter();
But I get Lint error ---
A call requires API level 18 (the current minimum is 8): android.bluetooth.BluetoothManager # getAdapter
So, I changed my code to
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Is code replacement for the above lint error?
source
share