diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java
index 62fa87aa1..e5121bccc 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java
@@ -81,7 +81,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
private ScanCallback newLeScanCallback = null;
// Disabled for testing, it seems worse for a few people
- private final boolean disableNewBLEScanning = false;
+ private boolean disableNewBLEScanning = false;
private final Handler handler = new Handler();
@@ -268,6 +268,11 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ disableNewBLEScanning = GBApplication.getPrefs().getBoolean("disable_new_ble_scanning", false);
+ if (disableNewBLEScanning) {
+ LOG.info("new BLE scanning disabled via settings, using old method");
+ }
+
setContentView(R.layout.activity_discovery);
startButton = findViewById(R.id.discovery_start);
startButton.setOnClickListener(new View.OnClickListener() {
@@ -395,11 +400,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
LOG.warn("Not starting discovery, because already scanning.");
return;
}
- if (GBApplication.isRunningLollipopOrLater() && !disableNewBLEScanning) {
- startDiscovery(Scanning.SCANNING_NEW_BTLE);
- } else {
- startDiscovery(Scanning.SCANNING_BTLE);
- }
+ startDiscovery(Scanning.SCANNING_BT);
}
private void startDiscovery(Scanning what) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cefc305e1..d64ba44da 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -252,6 +252,10 @@
Fetch happens upon screen unlock. Only works if a lock mechanism is set!
Minimum time between fetches
Fetches every %d minutes
+
+ Disable new BLE scanning
+ Check this option if your device cannot be found during discovery
+
Not connected
Connecting
Connected
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index ff5ed9558..6813452de 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -627,5 +627,12 @@
android:defaultValue="false"
android:key="log_to_file"
android:title="@string/pref_write_logfiles" />
+
+