Badge on App icon

♀尐吖头ヾ 提交于 2020-02-03 08:52:19

问题


I need to show badge on App icon in my application

what i have tried:

  1. This https://github.com/leolin310148/ShortcutBadger library do it on many devices.I have checked its manifest and saw that there exists a permission for each type of launcher

     <!--for Samsung-->
       <uses-permission      android:name="com.sec.android.provider.badge.permission.READ"/>
     <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>
    
     <!--for htc-->
    <uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/>
     <uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT"/>
    
      <!--for sony-->
     <uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/>
     <uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE"/>
    <!--for apex-->
    <uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT"/>
    
     <!--for solid-->
     <uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>
    
     <!--for huawei-->
     <uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
     <uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
     <uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
    
     <!--for ZUK-->
     <uses-permission android:name="android.permission.READ_APP_BADGE"/>
    

2.I have gone through many available answers that are already on stackoverflow like

How to display count of notifications in app launcher icon

can we show badge number on android app icon like iphone?

How to show badge count with app icon on Redmi?

Add unread notification badge on android app icon

Is there a way to add a badge to an application icon in Android?

All these resources helped me to attain the task on above mentioned devices but i can still see there are lot man devices like xiomi,micromax etc in which app like wtsapp,facebook etc are showing badges but i am unable to show badge on these devices.

Have anyone here has achieved it.Any help will be appreciated.


回答1:


This is not a feature the of Android system. Device manufacturers (like Xiaomi you mentioned) or launcher developers (like Nova Launcher) can implement it and expose an api for app developers, but there is no standard for that, nor is it expected by the users to be there.

In general, you should not try to do this on Android.




回答2:


For displaying badge, Google may have stopped showing numbers count on App Icon as a badge but I think it's still showing a dot to let the user know there is something new to that app.

For more information you can go through this official link from Google : https://developer.android.com/training/notify-user/badges



来源:https://stackoverflow.com/questions/40148979/badge-on-app-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!