Share via

Android: The push notification badge is not disappearing on my app icon after I open my app again

Kim Strasser 2,366 Reputation points
2026-04-07T10:28:37.54+00:00

I have tried to send push notifications to my app. I always receive the push notifications on my Android mobile phone and a badge is displayed on my app icon. But this badge never disappears. I have tried to tap again on my app icon to open it and I have even tried to quit the app and then open it again but the badge doesn´t disappear. Why does the badge not disappear? Is it necessary to do something in my code to make the badge disappear?

I have installed my app in debug mode on my Android mobile phone, then I closed Visual Studio and I have tried to send push notifications to my app.

Developer technologies | .NET | .NET MAUI

2 answers

Sort by: Most helpful
  1. Nancy Vo (WICLOUD CORPORATION) 2,225 Reputation points Microsoft External Staff Moderator
    2026-04-08T04:25:16.2066667+00:00

    Hi @Kim Strasser ,

    Thanks for your question.

    Android does not automatically reset the app icon badge just because the app was launched. So I recommend clearing the notifications by adding these two methods to Activity1.cs (the main activity):

    using AndroidX.Core.App;           
    using CommunityToolkit.Maui;
    
    protected override void OnResume()
    {
        base.OnResume();
        ClearBadgeAndNotifications();
    }
    
    protected override void OnNewIntent(Intent intent)
    {
        base.OnNewIntent(intent);
        ClearBadgeAndNotifications();
    }
    
    private void ClearBadgeAndNotifications()
    {
        var notificationManager = NotificationManagerCompat.From(this);
        notificationManager.CancelAll();
    
        try
        {
            Badge.Default.SetCount(0);   // You need to install CommunityToolkit.Maui
        }
        catch { }
    }
    

    Also update OnCreate to call it once after setup if needed:

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        // ... your existing code
        ClearBadgeAndNotifications();
    }
    

    Note: Setup if you want to use Badge.Default.SetCount(0):

    • Install the NuGet package CommunityToolkit.Maui
    • In your startup code (usually MainApplication.cs or MauiProgram.cs), make sure you have builder.UseMauiCommunityToolkit();

    After adding the code, please clean and rebuild your project. Then, uninstall the app -> reinstall and test again.

    On some phones, the badge may still not clear perfectly. In that case:

    • Please long-press your app icon -> App info -> Notifications -> Turn "Notification dot" or "Badges" off and back on.
    • Or go to Settings → Apps → Your App → Storage → Clear Cache.

    Please give it a try and let me know if it works as expected.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.


  2. Q&A Assist
    2026-04-07T10:28:50.48+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    On Android there is no single, automatic system behavior for clearing app icon badges. Each launcher (Samsung, Microsoft Launcher, etc.) implements its own logic, and badges are typically driven either by:

    • The launcher’s own unread-count tracking (for example, unread notifications or messages), or
    • Explicit badge-count updates from the app’s code, using a launcher-specific mechanism.

    Because of this, the badge will not necessarily disappear just because the app is opened. The app usually needs to update or clear the badge count in code when the relevant content (for example, notifications or messages) is considered “read”.

    With .NET MAUI and the CommunityToolkit Badge API, the behavior is explicitly under application control. The toolkit documentation notes that:

    • Android does not provide a standardized API for badge counts.
    • Different launchers (including Microsoft Launcher and others) have their own mechanisms.
    • The app must implement launcher-specific logic to ensure badges appear and clear correctly.

    In practice this means:

    1. Implement an IBadgeProvider for each launcher that should be supported (for example, Samsung, Microsoft Launcher, etc.).
    2. Register those providers in the Android MainApplication constructor using BadgeFactory.SetBadgeProvider(...).
    3. When a push notification is handled (for example, when the user opens the app from the notification or views the related content), explicitly set the badge count to the desired value (often 0) via the badge provider logic.

    If this logic is not implemented, or if the launcher in use is not covered by a provider, the launcher may keep showing the last badge count indefinitely, which matches the behavior being observed.

    So yes, code changes are required: the app must explicitly manage badge counts per launcher and clear or reset them when appropriate (for example, after processing the push notification or marking items as read).


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.