mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Auto connect at boot on recent androids respecting the user settings
Automatically connect at boot if gadgetbridge is configured to start at boot and to attempt an automatic connection when bluetooth is available Fixes #693 and fixes #891
This commit is contained in:
+7
-1
@@ -32,7 +32,13 @@ public class AutoStartReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (GBApplication.getGBPrefs().getAutoStart() && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
Log.i(TAG, "Boot completed, starting Gadgetbridge");
|
||||
GBApplication.deviceService().start();
|
||||
if (GBApplication.getPrefs().getBoolean("general_autoconnectonbluetooth", false)) {
|
||||
Log.i(TAG, "Autoconnect is enabled, attempting to connect");
|
||||
GBApplication.deviceService().connect();
|
||||
} else {
|
||||
GBApplication.deviceService().start();
|
||||
}
|
||||
|
||||
PeriodicExporter.enablePeriodicExport(context);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user