11

I want to display the unread count to the application icon. I refer the lots of stack overflow answers for achieving that. All the links are saying that it is not possible. But android Mail, Message application displays the unread count at the top of the icon and in some links says that use widget instead of icons. But I don't know how to use the widget instead of icon displays in android application.

enter image description here

Like the above image I want to display unread count in my application icon.

Manuel Allenspach
  • 12,467
  • 14
  • 54
  • 76
Android_kalai
  • 423
  • 1
  • 7
  • 19
  • possible duplicate of [Is there a way to add a badge to an application icon in Android?](http://stackoverflow.com/questions/2905542/is-there-a-way-to-add-a-badge-to-an-application-icon-in-android) – bummi May 13 '14 at 12:01
  • This solution works in my case: http://stackoverflow.com/a/24804467/957954 – Vlad Yarovyi Jul 17 '14 at 13:10

2 Answers2

14

Unfortunately, You can't do that on application icon. Android doesn't allow that.

But you can do that using widget. There are many question related this, check it first.

Question 1

Question 2

Question 3

Widget Example

Widget Link

Update : 24/04/2015

Now this is possible for some launcher app.

Check this ShortcutBadger and BadgeUtils

Update

Android allow Modify a Notification Badge from Android 8.0 (PI level 26).

Niranj Patel
  • 32,980
  • 10
  • 97
  • 133
  • Thanks for your response.. yes I already refer these answers.But my requirement is how to using widget instead of application icon..Any sample coding is there???? – Android_kalai Aug 17 '13 at 05:24
  • [look here for widget](http://developer.android.com/guide/topics/appwidgets/index.html) – Niranj Patel Aug 17 '13 at 05:30
  • Yes i know how to create widgets..but i want to know how to use widgets instead of application icons(How to display widgets instead of displaying app icon) – Android_kalai Aug 17 '13 at 05:36
  • Ok.But in some application(facebook,message,Gmail) displays count in application icon itself..These application icon is in app drawer screen. – Android_kalai Aug 17 '13 at 05:51
  • @Android_kalai yes you are right, all application developed on system os expect facebook. may be system os given some authority to facebook for that.. In this days facebook is also unbuild app for new devices.. – Niranj Patel Aug 17 '13 at 05:54
  • Ok..thanks for ur suggestions..Really forward to some more updates about my requirement – Android_kalai Aug 17 '13 at 06:51
  • https://gist.github.com/Tadas44/cdae2f5995f21bf1c27f \n https://github.com/leolin310148/ShortcutBadger – DeepakPanwar Apr 23 '15 at 17:35
  • @CapDroid I think android should provide this functionality in its new release. In some demos on github it is done using reflection technique. And some says it is not supported in Android L, I don`t have L but i have tested this in kitkat it works fine. – DeepakPanwar Apr 24 '15 at 15:32
  • Why some apps can use ? like Telegram,whatsapp.. ? – S.M_Emamian Jan 29 '16 at 12:29
3
  1. Showing Badge in application icon is not allowed by default in Android. We can do this in some of the customized devices available in android: Below are the links how we can show on some Device like Sony,Samsung etc.

https://github.com/leolin310148/ShortcutBadger

Utility Class I found on git:- will be helpful also

https://gist.github.com/Tadas44/cdae2f5995f21bf1c27f

  1. And for rest of the Non customized devices we can create a custom widget to reflect this same behaviour.

See How to create Widget: https://looksok.wordpress.com/2012/12/15/android-complete-widget-tutorial-including-source-code/

DeepakPanwar
  • 1,389
  • 14
  • 22