Add badge for unread messages and add badge for messages
Add badge to unread message of Application
The app badge is a feature of iOS, which is not supported by native Android. During project development, the project needs to display the badge of the number of new messages on the mobile phone desktop icon. The desktop badge function does not provide such APIs in the native android system, this type of feature is available only for android systems that have been deeply customized by third parties, such as Samsung, Xiaomi, meizu, and Huawei. However, the problem is that each custom method is different, we generally use third-party open-source projects for implementation.
Two Github projects are provided here:
Https://github.com/leolin310148/ShortcutBadger
Https://github.com/xuyisheng/ShortcutHelper
Here we use ShortcutBadger as an example to explain
How to add dependency support
compile "me.leolin:ShortcutBadger:1.1.13@aar"
Add a message badge
ShortcutBadger.applyCount(context, number);
Remove message
boolean isRemoveSuccess = ShortcutBadger.removeCount(this);
Permission problems
Some mobile phones fail to take effect, and you have no intention of solving the problem after you have applied for it.
Effect
Is the Display Effect on lg