1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-03 11:33:19 +02:00

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.
This commit is contained in:
Andreas Shimokawa 2016-03-22 13:43:01 +01:00
parent 5eb2d04513
commit 767f359319

View File

@ -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;
}