Goal is to read the values of a bluetooth LE heart rate monitor.
Using google\'s sample, I get
private void scanLeDevice(final boolean enable) {
Remember that the method:
public BluetoothLeScanner getBluetoothLeScanner ()
isn't static. If you do:
BluetoothAdapter.getBluetoothLeScanner()
you will get an error, since getDefaultAdapter() is a static method, but getBluetoothLeScanner() isn't.
You need an instance of a BluetoothAdapter. You can get one by doing:
(BluetoothManager) mContext.getSystemService(Context.BLUETOOTH_SERVICE).getAdapter()
That way, you can try:
Context mContext = getBaseContext();
BluetoothAdapter mAdapter = ((BluetoothManager) mContext.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
BluetoothLeScanner mLeScanner = mAdapter.getBluetoothLeScanner();
mLeScanner.startScan(...);
More info here: http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html