From 767f359319cea6c30755716a61b07f2a5f2a8054 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Tue, 22 Mar 2016 13:43:01 +0100 Subject: [PATCH] Launch Android's Bluetooth settings instead of our activiy on Android >= 6.0 BLE scanning does not work on Android 6.0 and for the Pebble it does not add any value anyway. --- .../gadgetbridge/activities/ControlCenter.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java index 13b04486..187c5c95 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java @@ -186,8 +186,7 @@ public class ControlCenter extends Activity { GBApplication.deviceService().start(); enableSwipeRefresh(selectedDevice); - if (GB.isBluetoothEnabled() && deviceList.isEmpty()) { - // start discovery when no devices are present + if (GB.isBluetoothEnabled() && deviceList.isEmpty() && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { startActivity(new Intent(this, DiscoveryActivity.class)); } else { GBApplication.deviceService().requestDeviceInfo(); @@ -334,8 +333,11 @@ public class ControlCenter extends Activity { LocalBroadcastManager.getInstance(this).sendBroadcast(quitIntent); return true; case R.id.action_discover: - Intent discoverIntent = new Intent(this, DiscoveryActivity.class); - startActivity(discoverIntent); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + startActivity(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS)); + } else { + startActivity(new Intent(this, DiscoveryActivity.class)); + } return true; }