gitmyhub

ShortcutBadger

Java ★ 7.3k updated 2y ago

An Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers.

An Android library that adds notification badge counts to app home screen icons across Samsung, LG, Sony, Xiaomi, and 10+ other manufacturer launchers, integrated with two method calls.

JavaAndroidMavensetup: easycomplexity 2/5

ShortcutBadger is an Android library that lets an app display a number badge on its home screen icon, the same way iOS shows red circles with unread counts on app icons. Because Android does not have a built-in system for this and each phone manufacturer implements home screen launchers differently, a library like this needs to communicate with each launcher individually. ShortcutBadger handles that work on behalf of the developer.

The library is available through Maven Central and added to a project by including one dependency line in the build configuration. Using it takes two method calls: one to set the badge count and one to remove it. This minimal API means most developers can get the feature working in a short amount of time.

Supported launchers include Samsung, LG, Sony, HTC, Xiaomi, ASUS, Huawei, OPPO, ZTE, Yandex, and several third-party launchers such as Nova, Apex, KISS, and ADW. Huawei and OPPO are listed as partially supported. Xiaomi devices require additional configuration documented in the project wiki, because Xiaomi handles notifications differently from most other Android devices.

A companion app called IsBadgeWorking is available on Google Play for anyone who wants to test whether their specific device and launcher combination is supported before integrating the library. The changelog in the README tracks every version back to 1.1.1 and shows a consistent pattern of adding new launcher support over time.

The project is developed by Leo Lin. The README notes that if a Google Play Developer Distribution Agreement warning arrives, switching to version 1.1.0 or higher resolves the issue.

Where it fits