diff --git a/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java b/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java index 4c34660d..bf379461 100644 --- a/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java +++ b/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java @@ -94,20 +94,21 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi @Override public void onReceive(Context context, Intent intent) { -// Miscellaneous.logEvent("i", "BluetoothReceiver", "Bluetooth event.", 4); - String action = intent.getAction(); + + Miscellaneous.logEvent("i", "BluetoothReceiver", "Bluetooth event: " + action, 5); + BluetoothDevice bluetoothDevice = null; - if(action.equals(BluetoothDevice.ACTION_ACL_CONNECTED) | action.equals("android.bluetooth.device.action.ACL_CONNECTED")) - { + if(action.equals(BluetoothDevice.ACTION_ACL_CONNECTED) || action.equals("android.bluetooth.device.action.ACL_CONNECTED")) + { bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); lastAffectedDevice = bluetoothDevice; lastAction = action; connectedDevices.add(bluetoothDevice); Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothConnectionTo), bluetoothDevice.getName()), 3); } - else if(action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) | action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED) | action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECTED") | action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECT_REQUESTED")) + else if(action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) || action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED) || action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECTED") || action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECT_REQUESTED")) { bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); lastAffectedDevice = bluetoothDevice; @@ -115,7 +116,7 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi connectedDevices.remove(bluetoothDevice); Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothDisconnectFrom), bluetoothDevice.getName()), 3); } - else if(action.equals(BluetoothDevice.ACTION_FOUND) | action.equals("android.bluetooth.device.ACTION_FOUND")) + else if(action.equals(BluetoothDevice.ACTION_FOUND) || action.equals("android.bluetooth.device.ACTION_FOUND")) { bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); lastAffectedDevice = bluetoothDevice; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b3f4cea4..8ca7d77f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -422,7 +422,7 @@ It appears no data change has been saved. However there may have been changes in memory that need to be rolled back. Rereading file. Bluetooth connection Bluetooth connection to %1$s - Bluetooth connection to %1$s torn + Bluetooth connection from %1$s torn Bluetooth device %1$s in range. Bluetooth device %1$s out of range. any device diff --git a/fastlane/metadata/android/en-US/changelogs/135.txt b/fastlane/metadata/android/en-US/changelogs/135.txt index 75c238ed..8d47fa7e 100644 --- a/fastlane/metadata/android/en-US/changelogs/135.txt +++ b/fastlane/metadata/android/en-US/changelogs/135.txt @@ -1,5 +1,6 @@ * Fixed: Added overlay permission for start-phone-call action * Fixed: Trigger "battery is charging" would only fire once and not after disconnecting and connecting charger * Fixed: Wifi trigger would not reliably fire upon disconnection +* Fixed: On Api level <=28 a permission was requested for ActivityDetection that could not be granted * Change: Icon changed in Play store version * Change: Was forced to raise targetSdk to 32 for Google Play version. If that should break something, consider switching to the F-Droid or APK version. \ No newline at end of file