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,6 +63,9 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC
} }
break; break;
case BluetoothAdapter.ACTION_DISCOVERY_FINISHED: case BluetoothAdapter.ACTION_DISCOVERY_FINISHED:
handler.post(new Runnable() {
@Override
public void run() {
// continue with LE scan, if available // continue with LE scan, if available
if (isScanning == Scanning.SCANNING_BT) { if (isScanning == Scanning.SCANNING_BT) {
checkAndRequestLocationPermission(); checkAndRequestLocationPermission();
@ -74,6 +77,8 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC
} else { } else {
discoveryFinished(); 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);