properly clear file adding notification if forground service channel is disabled

This commit is contained in:
Daniel Gultsch 2018-09-06 22:05:15 +02:00
parent 39b86de698
commit ac7f0032af
2 changed files with 6 additions and 0 deletions

View File

@ -883,6 +883,7 @@ public class NotificationService {
mBuilder.setProgress(100, current, false); mBuilder.setProgress(100, current, false);
mBuilder.setSmallIcon(R.drawable.ic_hourglass_empty_white_24dp); mBuilder.setSmallIcon(R.drawable.ic_hourglass_empty_white_24dp);
mBuilder.setContentIntent(createContentIntent(message.getConversation())); mBuilder.setContentIntent(createContentIntent(message.getConversation()));
mBuilder.setOngoing(true);
if (Compatibility.twentySix()) { if (Compatibility.twentySix()) {
mBuilder.setChannelId("compression"); mBuilder.setChannelId("compression");
} }
@ -890,6 +891,10 @@ public class NotificationService {
notify(FOREGROUND_NOTIFICATION_ID, notification); notify(FOREGROUND_NOTIFICATION_ID, notification);
} }
public void dismissForcedForegroundNotification() {
cancel(FOREGROUND_NOTIFICATION_ID);
}
private void notify(String tag, int id, Notification notification) { private void notify(String tag, int id, Notification notification) {
final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService); final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService);
try { try {

View File

@ -407,6 +407,7 @@ public class XmppConnectionService extends Service {
public void stopForcingForegroundNotification() { public void stopForcingForegroundNotification() {
mForceForegroundService.set(false); mForceForegroundService.set(false);
toggleForegroundService(); toggleForegroundService();
mNotificationService.dismissForcedForegroundNotification();
} }
public boolean areMessagesInitialized() { public boolean areMessagesInitialized() {