Autostart error fixed

This commit is contained in:
Jens 2023-01-16 23:44:28 +01:00
parent 52edfa32df
commit a9646cbf28
4 changed files with 12 additions and 5 deletions

View File

@ -111,6 +111,8 @@ import androidx.documentfile.provider.DocumentFile;
public class Miscellaneous extends Service public class Miscellaneous extends Service
{ {
protected static String writeableFolderStringCache = null; protected static String writeableFolderStringCache = null;
public static Context startupContext;
public static final String lineSeparator = System.getProperty("line.separator"); public static final String lineSeparator = System.getProperty("line.separator");
public static String downloadURL(String url, String username, String password) public static String downloadURL(String url, String username, String password)
@ -273,7 +275,7 @@ public class Miscellaneous extends Service
{ {
writeToLogFile(type, header, description); writeToLogFile(type, header, description);
if(!logCleanerRunning && Math.random() < 0.1) // tidy up with 10% probability if (!logCleanerRunning && Math.random() < 0.1) // tidy up with 10% probability
{ {
rotateLogFile(getLogFile()); rotateLogFile(getLogFile());
} }
@ -557,7 +559,10 @@ public class Miscellaneous extends Service
returnContext = ActivityPermissions.getInstance().getApplicationContext(); returnContext = ActivityPermissions.getInstance().getApplicationContext();
if(returnContext != null) if(returnContext != null)
return returnContext; return returnContext;
if(startupContext != null)
return startupContext;
return null; return null;
} }

View File

@ -494,7 +494,7 @@ public class PointOfInterest implements Comparable<PointOfInterest>
Check for change of rule name END Check for change of rule name END
*/ */
if (plausibilityCheck()) if(plausibilityCheck())
{ {
Miscellaneous.logEvent("i", "Changing POI", "Old name: " + this.oldName + ", new data: " + this.toStringLong(), 3); Miscellaneous.logEvent("i", "Changing POI", "Old name: " + this.oldName + ", new data: " + this.toStringLong(), 3);

View File

@ -11,12 +11,13 @@ import com.jens.automation2.Settings;
public class StartupIntentReceiver extends BroadcastReceiver public class StartupIntentReceiver extends BroadcastReceiver
{ {
@Override @Override
public void onReceive(Context context, Intent intent) public void onReceive(Context context, Intent intent)
{ {
Settings.readFromPersistentStorage(context); Settings.readFromPersistentStorage(context);
Miscellaneous.startupContext = context;
// Miscellaneous.logEvent("i", "Boot event", "Received event: " + intent.getAction(), 5); // Miscellaneous.logEvent("i", "Boot event", "Received event: " + intent.getAction(), 5);
if(Settings.startServiceAtSystemBoot) if(Settings.startServiceAtSystemBoot)

View File

@ -1,2 +1,3 @@
* Fixed: Now allowing negative integers as intent data * Fixed: Now allowing negative integers as intent data
* Fixed: Multiple time frames with reoccurence configured would trigger to early executions * Fixed: Multiple time frames with reoccurence configured would trigger to early executions
* Fixed: Automatic app start at boot might fail in some cases