Merge pull request #3950 from deltachat/adb/issue-3944

don't show badge-counter in app icon for permanent notification
This commit is contained in:
adb
2025-10-29 00:11:39 +01:00
committed by GitHub
4 changed files with 13 additions and 1 deletions
+4
View File
@@ -1,5 +1,9 @@
# Delta Chat Android Changelog
## Unreleased
* don't show badge counter in app icon for the permanent background notification
## v2.22.0
2025-10
@@ -12,6 +12,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.app.NotificationManagerCompat;
import androidx.multidex.MultiDexApplication;
import androidx.work.Constraints;
import androidx.work.ExistingPeriodicWorkPolicy;
@@ -89,6 +90,12 @@ public class ApplicationContext extends MultiDexApplication {
dcAccounts = new DcAccounts(new File(getFilesDir(), "accounts").getAbsolutePath());
rpc = new Rpc(new FFITransport(dcAccounts.getJsonrpcInstance()));
AccountManager.getInstance().migrateToDcAccounts(this);
// October-2025 migration: delete deprecated "permanent channel" id
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.deleteNotificationChannel("dc_foreground_notification_ch");
// end October-2025 migration
int[] allAccounts = dcAccounts.getAll();
for (int accountId : allAccounts) {
DcContext ac = dcAccounts.getAccount(accountId);
@@ -121,6 +121,7 @@ public class KeepAliveService extends Service {
NotificationChannel channel = new NotificationChannel(NotificationCenter.CH_PERMANENT,
"Receive messages in background.", NotificationManager.IMPORTANCE_MIN); // IMPORTANCE_DEFAULT will play a sound
channel.setDescription("Ensure reliable message receiving.");
channel.setShowBadge(false);
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
@@ -241,7 +241,7 @@ public class NotificationCenter {
// channelIds: CH_MSG_* are used here, the other ones from outside (defined here to have some overview)
public static final String CH_MSG_PREFIX = "ch_msg";
public static final String CH_MSG_VERSION = "5";
public static final String CH_PERMANENT = "dc_foreground_notification_ch";
public static final String CH_PERMANENT = "dc_fg_notification_ch";
public static final String CH_GENERIC = "ch_generic";
public static final String CH_CALLS_PREFIX = "call_chan";