mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
#33 only start discovery activity when bt is enabled
This commit is contained in:
parent
cf360455a0
commit
1604ae2c22
@ -111,7 +111,7 @@ public class ControlCenter extends Activity {
|
||||
startService(startIntent);
|
||||
|
||||
|
||||
if (deviceList.isEmpty()) {
|
||||
if (GB.isBluetoothEnabled() && deviceList.isEmpty()) {
|
||||
// start discovery when no devices are present
|
||||
startActivity(new Intent(this, DiscoveryActivity.class));
|
||||
} else {
|
||||
|
@ -3,6 +3,7 @@ package nodomain.freeyourgadget.gadgetbridge;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -73,6 +74,11 @@ public class GB {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isBluetoothEnabled() {
|
||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
return adapter != null && adapter.isEnabled();
|
||||
}
|
||||
|
||||
public static String hexdump(byte[] buffer, int offset, int length) {
|
||||
final char[] hexArray = "0123456789ABCDEF".toCharArray();
|
||||
char[] hexChars = new char[length * 2];
|
||||
|
Loading…
Reference in New Issue
Block a user