diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index c49739e090..c4e093ef04 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -90,7 +90,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar EntityLog.log(this, "Service send create"); super.onCreate(); startForeground(NotificationHelper.NOTIFICATION_SEND, - getNotificationService().build()); + getNotificationService(false).build()); owner = new TwoStateOwner(this, "send"); @@ -110,7 +110,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(NotificationHelper.NOTIFICATION_SEND, - getNotificationService().build()); + getNotificationService(false).build()); } catch (Throwable ex) { Log.w(ex); } @@ -205,7 +205,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); startForeground(NotificationHelper.NOTIFICATION_SEND, - getNotificationService().build()); + getNotificationService(false).build()); Log.i("Send intent=" + intent); Log.logExtras(intent); @@ -213,7 +213,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar return START_STICKY; } - NotificationCompat.Builder getNotificationService() { + NotificationCompat.Builder getNotificationService(boolean alert) { NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "send") .setSmallIcon(R.drawable.baseline_send_white_24) @@ -221,7 +221,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar .setContentIntent(getPendingIntent(this)) .setAutoCancel(false) .setShowWhen(true) - .setOnlyAlertOnce(true) + .setOnlyAlertOnce(!alert) .setDefaults(0) // disable sound on pre Android 8 .setLocalOnly(true) .setPriority(NotificationCompat.PRIORITY_MIN) @@ -334,7 +334,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(NotificationHelper.NOTIFICATION_SEND, - getNotificationService().build()); + getNotificationService(false).build()); } catch (Throwable ex) { Log.w(ex); } @@ -521,7 +521,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - nm.notify(NotificationHelper.NOTIFICATION_SEND, getNotificationService().build()); + nm.notify(NotificationHelper.NOTIFICATION_SEND, getNotificationService(true).build()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean reply_move = prefs.getBoolean("reply_move", false); @@ -735,7 +735,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar if (now > last + PROGRESS_UPDATE_INTERVAL) { last = now; lastProgress = progress; - nm.notify(NotificationHelper.NOTIFICATION_SEND, getNotificationService().build()); + nm.notify(NotificationHelper.NOTIFICATION_SEND, getNotificationService(false).build()); } } } @@ -776,7 +776,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar iservice.close(); if (lastProgress >= 0) { lastProgress = -1; - nm.notify(NotificationHelper.NOTIFICATION_SEND, getNotificationService().build()); + nm.notify(NotificationHelper.NOTIFICATION_SEND, getNotificationService(false).build()); } db.identity().setIdentityState(ident.id, null); }