diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java index e03a3f5..d321172 100644 --- a/app/src/main/java/com/jens/automation2/Miscellaneous.java +++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java @@ -314,15 +314,18 @@ public class Miscellaneous extends Service header = "Automation"; } - if(type.equals("e")) - Log.e(header, description); + if(Settings.logToConsole) + { + if (type.equals("e")) + Log.e(header, description); + + if (type.equals("w")) + Log.w(header, description); + + if (type.equals("i")) + Log.i(header, description); + } - if(type.equals("w")) - Log.w(header, description); - - if(type.equals("i")) - Log.i(header, description); - if(Settings.writeLogFile && Settings.logLevel >= logLevel) { writeToLogFile(type, header, description); diff --git a/app/src/main/java/com/jens/automation2/Settings.java b/app/src/main/java/com/jens/automation2/Settings.java index 41bf314..dac8e33 100644 --- a/app/src/main/java/com/jens/automation2/Settings.java +++ b/app/src/main/java/com/jens/automation2/Settings.java @@ -30,6 +30,7 @@ public class Settings implements SharedPreferences public static int gpsTimeout; public static long minimumTimeBetweenUpdate; public static boolean startServiceAtSystemBoot; + public static boolean logToConsole; public static boolean writeLogFile; public static long logLevel; public static int logFileMaxSize; @@ -98,6 +99,7 @@ public class Settings implements SharedPreferences public static final int default_gpsTimeout = 300; // seconds public static final long default_minimumTimeBetweenUpdate = 30000; // in Milliseconds public static final boolean default_startServiceAtSystemBoot = false; + public static final boolean default_logToConsole = false; public static final boolean default_writeLogFile = false; public static final long default_logLevel = 2; public static final int default_logFileMaxSize = 10; @@ -199,6 +201,7 @@ public class Settings implements SharedPreferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); startServiceAtSystemBoot = prefs.getBoolean("startServiceAtSystemBoot", default_startServiceAtSystemBoot); + logToConsole = prefs.getBoolean("logToConsole", default_logToConsole); writeLogFile = prefs.getBoolean("writeLogFile", default_writeLogFile); boolean useTextToSpeech = false; @@ -339,6 +342,9 @@ public class Settings implements SharedPreferences if(!prefs.contains("startServiceAtSystemBoot") || force) editor.putBoolean("startServiceAtSystemBoot", default_startServiceAtSystemBoot); + + if(!prefs.contains("logToConsole") || force) + editor.putBoolean("logToConsole", default_logToConsole); if(!prefs.contains("writeLogFile") || force) editor.putBoolean("writeLogFile", default_writeLogFile); @@ -515,6 +521,7 @@ public class Settings implements SharedPreferences Editor editor = prefs.edit(); editor.putBoolean("startServiceAtSystemBoot", startServiceAtSystemBoot); + editor.putBoolean("logToConsole", logToConsole); editor.putBoolean("writeLogFile", writeLogFile); // editor.putBoolean("useTextToSpeech", useTextToSpeech); editor.putBoolean("useTextToSpeechOnNormal", useTextToSpeechOnNormal); diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 8ce9375..06bc4bb 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -28,6 +28,11 @@ android:summary="@string/showIconWhenServiceIsRunning" android:title="@string/showIcon" /> + + In the following dialog do not try to select specific files, but choose the folder in which the Automation backup files reside. If the choose button is disabled, you have found an Android limitation. In that case try moving the files to a subdirectory first. matches does not match + Log to console (logcat) \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/144.txt b/fastlane/metadata/android/en-US/changelogs/144.txt index 39f8853..d10ecab 100644 --- a/fastlane/metadata/android/en-US/changelogs/144.txt +++ b/fastlane/metadata/android/en-US/changelogs/144.txt @@ -1,2 +1,3 @@ * Fixed: Crash when triggering a URL without parameter pairs -* Fixed: When checking for battery charging type "any" the trigger didn't fire. \ No newline at end of file +* Fixed: When checking for battery charging type "any" the trigger didn't fire. +* Added: Settings to turn on/off console logging (logcat) \ No newline at end of file