mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-28 20:06:29 +01:00
Added no clear flag to ongoing notifications
This commit is contained in:
@@ -19,6 +19,7 @@ package eu.faircode.email;
|
||||
Copyright 2018-2022 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -58,8 +59,7 @@ public class ServiceExternal extends Service {
|
||||
public void onCreate() {
|
||||
Log.i("Service external create");
|
||||
super.onCreate();
|
||||
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL,
|
||||
getNotification().build());
|
||||
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL, getNotification());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,8 +76,7 @@ public class ServiceExternal extends Service {
|
||||
Log.logExtras(intent);
|
||||
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL,
|
||||
getNotification().build());
|
||||
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL, getNotification());
|
||||
|
||||
if (intent == null)
|
||||
return START_NOT_STICKY;
|
||||
@@ -126,7 +125,7 @@ public class ServiceExternal extends Service {
|
||||
return null;
|
||||
}
|
||||
|
||||
private NotificationCompat.Builder getNotification() {
|
||||
private Notification getNotification() {
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this, "service")
|
||||
.setSmallIcon(R.drawable.baseline_compare_arrows_white_24)
|
||||
@@ -140,7 +139,9 @@ public class ServiceExternal extends Service {
|
||||
.setLocalOnly(true)
|
||||
.setOngoing(true);
|
||||
|
||||
return builder;
|
||||
Notification notification = builder.build();
|
||||
notification.flags |= Notification.FLAG_NO_CLEAR;
|
||||
return notification;
|
||||
}
|
||||
|
||||
private static void poll(Context context, Intent intent) {
|
||||
|
||||
Reference in New Issue
Block a user