ShortcutBadger Documentation

repository·master·Indexed 27 days ago

https://github.com/leolin310148/shortcutbadger

An Android library for displaying unread message counts as badges on application shortcuts across various device launchers, including Samsung, Sony, LG, and Xiaomi. Provides APIs for applying and removing badge counts, with specific support for Xiaomi devices and compliance with Google Play Developer Terms for version 1.1.0 and higher.

Tokens
485
Snippets
2
Records
6
Agent score
43%

What's inside ShortcutBadger

  1. Install ShortcutBadger via Maven Central

    master

    To use ShortcutBadger in your Android project, add mavenCentral() to your build script repositories and include the ShortcutBadger dependency in your app's dependencies block.

    // 1. Add mavenCentral to your build script
    repositories {
        mavenCentral()
    }
    
    // 2. Add dependencies
    dependencies {
        implementation "me.leolin:ShortcutBadger:1.1.22@aar"
    }
  2. Use legacy ShortcutBadger API (v1.1.3)

    master

    If you are working with version 1.1.3 of ShortcutBadger, use the .with().count() and .with().remove() builder pattern instead of the direct applyCount method.

    int badgeCount = 1;
    // For 1.1.3
    ShortcutBadger.with(getApplicationContext()).count(badgeCount);
    
    // To remove for 1.1.3
    ShortcutBadger.with(getApplicationContext()).remove();