Add badge for unread messages and add badge for messages

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.