1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01: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(); GBApplication.deviceService().start();
enableSwipeRefresh(selectedDevice); enableSwipeRefresh(selectedDevice);
if (GB.isBluetoothEnabled() && deviceList.isEmpty()) { if (GB.isBluetoothEnabled() && deviceList.isEmpty() && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
// start discovery when no devices are present
startActivity(new Intent(this, DiscoveryActivity.class)); startActivity(new Intent(this, DiscoveryActivity.class));
} else { } else {
GBApplication.deviceService().requestDeviceInfo(); GBApplication.deviceService().requestDeviceInfo();
@ -334,8 +333,11 @@ public class ControlCenter extends Activity {
LocalBroadcastManager.getInstance(this).sendBroadcast(quitIntent); LocalBroadcastManager.getInstance(this).sendBroadcast(quitIntent);
return true; return true;
case R.id.action_discover: case R.id.action_discover:
Intent discoverIntent = new Intent(this, DiscoveryActivity.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
startActivity(discoverIntent); startActivity(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS));
} else {
startActivity(new Intent(this, DiscoveryActivity.class));
}
return true; return true;
} }