Simple implementation of adding digital corner markers to Android Applications

Corner sign, English is badge, which means "badge, badge, medal; symbol, mark".

design sketch

You can see the red circle in the upper right corner of the ring letter chat app in the figure. The number 6 in it is a kind of corner mark.

Generally speaking, the corner mark of the application is used to mark how many notifications are unread. Once you click the prompt to read the application, the corner mark will disappear.

Some necessary instructions

The corner mark was originally a thing in Apple's IOS. Android native does not support corner marks, because Google means to let everyone use the notification (prompt bar), but it doesn't hurt. Powerful Android third-party manufacturers can add corner marks by operating in a custom launcher.

principle

The principle of adding corner markers is to send a broadcast, and specify the packagename (package name), classname (class name) and count (number of corner markers) of the application to be added in the broadcast intent. Of course, the action of intent operated by corner markers of mobile phones from different manufacturers is different.

Add permissions to read and write corner markers in androidmanifest.xml:

Tools for setting and clearing corner markers

be careful:

Because different mobile phone manufacturers have different actions, some mobile phones may not be used. Here we recommend a third-party library of GitHub: https://github.com/leolin310148/ShortcutBadger

GitHub address: https://github.com/zhouxu88/AppBadge

Full demo download address: appbadge_ jb51.rar

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>