mirror of https://github.com/M66B/FairEmail.git
Workaround pending intent problem Xiaomi / Android 11
This commit is contained in:
parent
10b299aca7
commit
e31ff84a67
|
@ -2979,8 +2979,12 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
PendingIntent pi;
|
||||
if (isBackgroundService(context))
|
||||
pi = PendingIntentCompat.getService(context, PI_WATCHDOG, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
else
|
||||
else {
|
||||
// Workaround for Xiaomi Android 11
|
||||
pi = PendingIntentCompat.getForegroundService(context, PI_WATCHDOG, intent, PendingIntent.FLAG_NO_CREATE);
|
||||
if (pi == null)
|
||||
pi = PendingIntentCompat.getForegroundService(context, PI_WATCHDOG, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
am.cancel(pi);
|
||||
|
|
Loading…
Reference in New Issue