diff --git a/app/build.gradle b/app/build.gradle index 17fa4b75..ccf6dbc3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { compileSdkVersion 31 buildToolsVersion '29.0.2' useLibrary 'org.apache.http.legacy' - versionCode 136 - versionName "1.7.19" + versionCode 138 + versionName "1.7.21" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java index 8f04a96f..51c71206 100644 --- a/app/src/main/java/com/jens/automation2/AutomationService.java +++ b/app/src/main/java/com/jens/automation2/AutomationService.java @@ -223,7 +223,10 @@ public class AutomationService extends Service implements OnInitListener startUpRoutine(); Intent myIntent = new Intent(this, ActivityMainTabLayout.class); - myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, 0); + if(getApplicationContext().getApplicationInfo().targetSdkVersion >= 31) + myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, PendingIntent.FLAG_MUTABLE); + else + myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, 0); notificationBuilder = createServiceNotificationBuilder(); updateNotification(); diff --git a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java index 8af75864..93b03392 100644 --- a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java +++ b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java @@ -145,7 +145,8 @@ public class ReceiverCoordinator } // startPhoneStateListener - PhoneStatusListener.startPhoneStatusListener(AutomationService.getInstance()); // also used to mute anouncements during calls + if(!BuildConfig.FLAVOR.equals(AutomationService.flavor_name_googleplay)) + PhoneStatusListener.startPhoneStatusListener(AutomationService.getInstance()); // also used to mute anouncements during calls // startConnectivityReceiver ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance()); diff --git a/app/src/main/java/com/jens/automation2/location/LocationProvider.java b/app/src/main/java/com/jens/automation2/location/LocationProvider.java index 8e98c6d9..c07828d2 100644 --- a/app/src/main/java/com/jens/automation2/location/LocationProvider.java +++ b/app/src/main/java/com/jens/automation2/location/LocationProvider.java @@ -11,6 +11,7 @@ import android.util.Log; import com.jens.automation2.ActivityMainScreen; import com.jens.automation2.AutomationService; +import com.jens.automation2.BuildConfig; import com.jens.automation2.Miscellaneous; import com.jens.automation2.PointOfInterest; import com.jens.automation2.R; @@ -232,6 +233,7 @@ public class LocationProvider public void startLocationService() { // startPhoneStateListener + if(!BuildConfig.FLAVOR.equals(AutomationService.flavor_name_googleplay)) PhoneStatusListener.startPhoneStatusListener(parentService); // also used to mute anouncements during calls // startConnectivityReceiver diff --git a/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java b/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java index 2d9f0e70..75f49e78 100644 --- a/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java +++ b/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java @@ -11,6 +11,7 @@ import android.util.Log; import androidx.annotation.RequiresApi; import com.jens.automation2.AutomationService; +import com.jens.automation2.BuildConfig; import com.jens.automation2.Miscellaneous; import com.jens.automation2.Rule; import com.jens.automation2.TimeFrame; @@ -243,7 +244,12 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis } Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class); - alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); + + if(Miscellaneous.getAnyContext().getApplicationContext().getApplicationInfo().targetSdkVersion >= 31) + alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); + else + alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); + centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate.time.getTimeInMillis(), alarmPendingIntent); SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm:ss"); diff --git a/fastlane/metadata/android/de-DE/changelogs/137.txt b/fastlane/metadata/android/de-DE/changelogs/137.txt new file mode 100644 index 00000000..1dbb68f8 --- /dev/null +++ b/fastlane/metadata/android/de-DE/changelogs/137.txt @@ -0,0 +1 @@ +* Fixed: Crashes at service start that only affected the Google Play version because of a higher targetSdk \ No newline at end of file diff --git a/fastlane/metadata/android/de-DE/changelogs/138.txt b/fastlane/metadata/android/de-DE/changelogs/138.txt new file mode 100644 index 00000000..e69de29b