Fixes for Google Play version

This commit is contained in:
Jens 2023-11-30 00:00:34 +01:00
parent 4f971e8a1b
commit e4828a9720
7 changed files with 18 additions and 5 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 31 compileSdkVersion 31
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
versionCode 136 versionCode 138
versionName "1.7.19" versionName "1.7.21"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -223,7 +223,10 @@ public class AutomationService extends Service implements OnInitListener
startUpRoutine(); startUpRoutine();
Intent myIntent = new Intent(this, ActivityMainTabLayout.class); 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(); notificationBuilder = createServiceNotificationBuilder();
updateNotification(); updateNotification();

View File

@ -145,7 +145,8 @@ public class ReceiverCoordinator
} }
// startPhoneStateListener // 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 // startConnectivityReceiver
ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance()); ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance());

View File

@ -11,6 +11,7 @@ import android.util.Log;
import com.jens.automation2.ActivityMainScreen; import com.jens.automation2.ActivityMainScreen;
import com.jens.automation2.AutomationService; import com.jens.automation2.AutomationService;
import com.jens.automation2.BuildConfig;
import com.jens.automation2.Miscellaneous; import com.jens.automation2.Miscellaneous;
import com.jens.automation2.PointOfInterest; import com.jens.automation2.PointOfInterest;
import com.jens.automation2.R; import com.jens.automation2.R;
@ -232,6 +233,7 @@ public class LocationProvider
public void startLocationService() public void startLocationService()
{ {
// startPhoneStateListener // startPhoneStateListener
if(!BuildConfig.FLAVOR.equals(AutomationService.flavor_name_googleplay))
PhoneStatusListener.startPhoneStatusListener(parentService); // also used to mute anouncements during calls PhoneStatusListener.startPhoneStatusListener(parentService); // also used to mute anouncements during calls
// startConnectivityReceiver // startConnectivityReceiver

View File

@ -11,6 +11,7 @@ import android.util.Log;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import com.jens.automation2.AutomationService; import com.jens.automation2.AutomationService;
import com.jens.automation2.BuildConfig;
import com.jens.automation2.Miscellaneous; import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule; import com.jens.automation2.Rule;
import com.jens.automation2.TimeFrame; import com.jens.automation2.TimeFrame;
@ -243,7 +244,12 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
} }
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class); 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); centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate.time.getTimeInMillis(), alarmPendingIntent);
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm:ss");

View File

@ -0,0 +1 @@
* Fixed: Crashes at service start that only affected the Google Play version because of a higher targetSdk