V4.1.3d - added settings option to inhibit the battery optimisation dialog in case it is annoying.

This commit is contained in:
Graham Jones
2023-02-07 20:47:56 +00:00
parent 5ebbc29056
commit 42b21ca937
5 changed files with 21 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="uk.org.openseizuredetector"
android:versionCode="115"
android:versionName="4.1.3c">
android:versionName="4.1.3d">
<!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

View File

@@ -228,11 +228,16 @@ public class StartupActivity extends AppCompatActivity {
if (powerManager.isIgnoringBatteryOptimizations(getPackageName())) {
Log.i(TAG, "Power Management OK - we are ignoring Battery Optimizations");
mBatteryOptDialogDisplayed = false;
} else {
boolean preventBatteryOptWarning = SP.getBoolean("PreventBatteryOptWarning", false);
if (preventBatteryOptWarning) {
Log.i(TAG,"PreventBatteryOptWarning is true, so not displaying battery optimisation dialog");
} else {
Log.e(TAG, "Power Management Problem - not ignoring Battery Optimisations");
//mUtil.showToast("WARNING - Phone is Optimising OpenSeizureDetector Battery Usage - this is likely to prevent it working correctly when running on battery!");
if (!mBatteryOptDialogDisplayed) showBatteryOptimisationWarningDialog();
}
}
// Check to see if this is the first time the app has been run, and display welcome dialog if it is.

View File

@@ -364,7 +364,8 @@
<string name="battery_usage_optimisation_dialog_text">
<b>WARNING: The Android System Battery Optimisation Settings are configured to \'Optimise\' OpenSeizureDetector.</b>\n\n
This means it is likely to be shutdown when operating on battery power, so will not work correctly\n\n
Please go into the Phone Settings and select <b>Apps->OpenSeizureDetector->Battery->Optimise battery usage</b> and set it so that OpenSeizureDetector is NOT optimised</string>
Please go into the Phone Settings and select <b>Apps->OpenSeizureDetector->Battery->Optimise battery usage</b> and set it so
that OpenSeizureDetector is NOT optimised (on Older versions of Andoroid this option is in </string>
<string name="local_data">Local Data</string>
<string name="shared_data">Shared Data</string>
<string name="prune_database">Prune Database</string>
@@ -467,4 +468,6 @@
<string name="notes_about_event">notes about event</string>
<string name="SpO2">O2 Sat</string>
<string name="data_sharing">Data Sharing</string>
<string name="prevent_bat_opt_summary">Do not display the battery optimisation dialog on start-up (some phones report that OpenSeizureDetector is optimised, even if it is not, so the dialog is a nuissance)</string>
<string name="prevent_bat_opt_title">Inhibit Battery Optimisation Warning Dialog</string>
</resources>

View File

@@ -69,6 +69,14 @@
android:title="@string/auto_start_title"
android:enabled="true"
/>
<CheckBoxPreference
android:defaultValue="false"
android:key="PreventBatteryOptWarning"
android:summary="@string/prevent_bat_opt_summary"
android:title="@string/prevent_bat_opt_title"
android:enabled="true"
/>
<Preference
android:key="SelectBLEDevice"
android:title="@string/select_ble_device_title"