diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ea251c7d..e428a693 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -13,6 +13,7 @@
+
= Build.VERSION_CODES.M) {
+ String packageName = getPackageName();
+ if (!pm.isIgnoringBatteryOptimizations(packageName)) {
+ Intent whitelist = new Intent();
+ whitelist.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
+ whitelist.setData(Uri.parse("package:" + packageName));
+ whitelist.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(whitelist);
+ }
+ }
+
updateNotification();
}
} else if (ACTION_UNLOCK_WAKE.equals(action)) {