@Override public void run() { is_scanning = false; try { if ((bluetooth_adapter != null) && (mLeScanCallback != null)) { bluetooth_adapter.stopLeScan(mLeScanCallback); } } catch (NullPointerException e) { // concurrency pain } invalidateOptionsMenu(); } }, SCAN_PERIOD);
@Override public void run() { is_scanning = false; try { if ((bluetooth_adapter != null) && (mLeScanCallback != null)) { bluetooth_adapter.stopLeScan(mLeScanCallback); } } catch (NullPointerException e) { // concurrency pain } invalidateOptionsMenu(); } }, SCAN_PERIOD);
@TargetApi(19) private synchronized void scanLeDevice(final boolean enable) { if (enable) { // Stops scanning after a pre-defined scan period. Log.d(TAG, "Start scan 19"); mHandler.postDelayed(new Runnable() { @Override public void run() { is_scanning = false; try { if ((bluetooth_adapter != null) && (mLeScanCallback != null)) { bluetooth_adapter.stopLeScan(mLeScanCallback); } } catch (NullPointerException e) { // concurrency pain } invalidateOptionsMenu(); } }, SCAN_PERIOD); is_scanning = true; if (bluetooth_adapter != null) bluetooth_adapter.startLeScan(mLeScanCallback); } else { is_scanning = false; if (bluetooth_adapter != null && bluetooth_adapter.isEnabled()) { bluetooth_adapter.stopLeScan(mLeScanCallback); } } invalidateOptionsMenu(); }
@TargetApi(19) private synchronized void scanLeDevice(final boolean enable) { if (enable) { // Stops scanning after a pre-defined scan period. Log.d(TAG, "Start scan 19"); mHandler.postDelayed(new Runnable() { @Override public void run() { is_scanning = false; try { if ((bluetooth_adapter != null) && (mLeScanCallback != null)) { bluetooth_adapter.stopLeScan(mLeScanCallback); } } catch (NullPointerException e) { // concurrency pain } invalidateOptionsMenu(); } }, SCAN_PERIOD); is_scanning = true; if (bluetooth_adapter != null) bluetooth_adapter.startLeScan(mLeScanCallback); } else { is_scanning = false; if (bluetooth_adapter != null && bluetooth_adapter.isEnabled()) { bluetooth_adapter.stopLeScan(mLeScanCallback); } } invalidateOptionsMenu(); }
@Override public void run() { is_scanning = false; if (bluetooth_adapter != null && bluetooth_adapter.isEnabled()) { try { lollipopScanner.stopScan(mScanCallback); } catch (IllegalStateException e) { JoH.static_toast_long(e.toString()); UserError.Log.e(TAG, "error stopping scan: " + e.toString()); } } invalidateOptionsMenu(); } }, SCAN_PERIOD);
@Override public void run() { is_scanning = false; if (bluetooth_adapter != null && bluetooth_adapter.isEnabled()) { try { lollipopScanner.stopScan(mScanCallback); } catch (IllegalStateException e) { JoH.static_toast_long(e.toString()); UserError.Log.e(TAG, "error stopping scan: " + e.toString()); } } invalidateOptionsMenu(); } }, SCAN_PERIOD);