mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
honor autoreconnect
We should also honor autoreconnect option before we auto connect on startup. Pressing Connect button does not check autoreconnect, it just sets autoreconnect and connects.
This commit is contained in:
parent
b961397597
commit
6c79bbb730
@ -281,8 +281,9 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
Prefs prefs = getPrefs();
|
||||
switch (action) {
|
||||
case ACTION_START:
|
||||
boolean autoReconnect = getGBPrefs().getAutoReconnect();
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (mBluetoothAdapter.isEnabled()) {
|
||||
if ((mBluetoothAdapter.isEnabled())&&(autoReconnect == true)) {
|
||||
intent.setAction(ACTION_CONNECT); // if bt is enabled go to connect so after reboot we autoconnect wihout prompts
|
||||
onStartCommand(intent,flags,startId);
|
||||
break;
|
||||
@ -324,7 +325,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
btDeviceAddress = gbDevice.getAddress();
|
||||
}
|
||||
|
||||
boolean autoReconnect = GBPrefs.AUTO_RECONNECT_DEFAULT;
|
||||
autoReconnect = GBPrefs.AUTO_RECONNECT_DEFAULT;
|
||||
if (prefs != null && prefs.getPreferences() != null) {
|
||||
prefs.getPreferences().edit().putString("last_device_address", btDeviceAddress).apply();
|
||||
autoReconnect = getGBPrefs().getAutoReconnect();
|
||||
|
Loading…
Reference in New Issue
Block a user