@Override protected void onResume() { super.onResume(); // Repopulate (which isn't too bad since it's cached in the settings // bluetooth manager addDevices(); if (mScreenType == SCREEN_TYPE_SETTINGS) { mEnabler.resume(); mDiscoverableEnabler.resume(); mNamePreference.resume(); } mLocalManager.registerCallback(this); mDeviceList.setProgress(mLocalManager.getBluetoothAdapter().isDiscovering()); mLocalManager.startScanning(false); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); registerReceiver(mReceiver, intentFilter); mLocalManager.setForegroundActivity(this); }
private void onBluetoothStateChanged(int bluetoothState) { // When bluetooth is enabled (and we are in the activity, which we are), // we should start a scan if (bluetoothState == BluetoothAdapter.STATE_ON) { mLocalManager.startScanning(false); } else if (bluetoothState == BluetoothAdapter.STATE_OFF) { mDeviceList.setProgress(false); } }
public void onScanningStateChanged(boolean started) { mDeviceList.setProgress(started); }