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
{
protected static String writeableFolderStringCache = null;
public static Context startupContext;
public static final String lineSeparator = System.getProperty("line.separator");
public static String downloadURL(String url, String username, String password)
@ -273,7 +275,7 @@ public class Miscellaneous extends Service
{
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());
}
@ -558,6 +560,9 @@ public class Miscellaneous extends Service
if(returnContext != null)
return returnContext;
if(startupContext != null)
return startupContext;
return null;
}

View File

@ -494,7 +494,7 @@ public class PointOfInterest implements Comparable<PointOfInterest>
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);

View File

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

View File

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