diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9372738dc..779e97796 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -718,6 +718,7 @@
Background notifications
Uses a background connection to your server and requires ignored battery optimizations.
+ Do you want to receive messages in the background?\n\nThis requires ignored battery optimizations, however, Delta Chat uses few resources and takes care not to drain your battery.
Reliable background connection
Requires a permanent notification
diff --git a/src/org/thoughtcrime/securesms/components/reminder/DozeReminder.java b/src/org/thoughtcrime/securesms/components/reminder/DozeReminder.java
index 1905d6156..1aa3b681b 100644
--- a/src/org/thoughtcrime/securesms/components/reminder/DozeReminder.java
+++ b/src/org/thoughtcrime/securesms/components/reminder/DozeReminder.java
@@ -10,6 +10,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.provider.Settings;
+import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
@@ -110,10 +111,17 @@ public class DozeReminder {
&& !Prefs.getBooleanPreference(context, Prefs.DOZE_ASKED_DIRECTLY, false)
&& ContextCompat.checkSelfPermission(context, Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) == PackageManager.PERMISSION_GRANTED
&& !((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
-
- Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
- Uri.parse("package:" + context.getPackageName()));
- context.startActivity(intent);
+ new AlertDialog.Builder(context)
+ .setTitle(R.string.pref_background_notifications)
+ .setMessage(R.string.pref_background_notifications_ask)
+ .setPositiveButton(R.string.perm_continue, (dialog, which) -> {
+ Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
+ Uri.parse("package:" + context.getPackageName()));
+ context.startActivity(intent);
+ })
+ .setNegativeButton(R.string.not_now, null)
+ .setCancelable(false)
+ .show();
}
// Prefs.DOZE_ASKED_DIRECTLY is also used above in isEligible().
// As long as Prefs.DOZE_ASKED_DIRECTLY is false, isEligible() will return false