1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-14 19:31:29 +02:00

Wild guess at trying to fix spontaneous reboots during discovery #412

This commit is contained in:
cpfeiffer 2016-10-28 23:48:13 +02:00
parent a941a6cd5f
commit 1cadb692fe

View File

@ -63,17 +63,22 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC
} }
break; break;
case BluetoothAdapter.ACTION_DISCOVERY_FINISHED: case BluetoothAdapter.ACTION_DISCOVERY_FINISHED:
// continue with LE scan, if available handler.post(new Runnable() {
if (isScanning == Scanning.SCANNING_BT) { @Override
checkAndRequestLocationPermission(); public void run() {
if (GBApplication.isRunningLollipopOrLater()) { // continue with LE scan, if available
startDiscovery(Scanning.SCANNING_NEW_BTLE); if (isScanning == Scanning.SCANNING_BT) {
} else { checkAndRequestLocationPermission();
startDiscovery(Scanning.SCANNING_BTLE); if (GBApplication.isRunningLollipopOrLater()) {
startDiscovery(Scanning.SCANNING_NEW_BTLE);
} else {
startDiscovery(Scanning.SCANNING_BTLE);
}
} else {
discoveryFinished();
}
} }
} else { });
discoveryFinished();
}
break; break;
case BluetoothAdapter.ACTION_STATE_CHANGED: case BluetoothAdapter.ACTION_STATE_CHANGED:
int oldState = intent.getIntExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, BluetoothAdapter.STATE_OFF); int oldState = intent.getIntExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, BluetoothAdapter.STATE_OFF);