Fix notification and increase min sdk

This commit is contained in:
Oizaro 2020-09-07 17:00:47 +02:00
parent d3a6ffb057
commit 088f6d4290
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ buildscript {
ext.androidBuildVersionTools = "29.0.3"
ext.androidMinSdk = 21
ext.androidMinSdk = 23
ext.androidTargetSdk = 29
ext.androidCompileSdk = 29

View File

@ -33,7 +33,7 @@ public class ForegroundServiceContext extends ContextWrapper {
public ComponentName startService(Intent service) {
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (!powerManager.isPowerSaveMode() && !isAppOnForeground()) {
if (!powerManager.isIgnoringBatteryOptimizations(this.getPackageName()) && !isAppOnForeground()) {
Log.d(TAG, "Starting in foreground mode.");
service.putExtra(EXTRA_FOREGROUND, true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {