Search code examples
androidandroid-notifications

Android/MIUI Setting small icon in notification bar not working? Default icon displayed


Tried every possibility to set small icon in status bar(which would get carried on by system as large icon in opened notification drawer) but nothing is working. Tried using raw .png file as well as drawable .xml files and combination of both(xml's referring to png as source of bitmap).

Also, I did add resource using AndroidStudio New -> Image Asset -> Notification icon which gracefully converted it to required versions and stripped from all colors except white and alpha channel.

No matter what I do the default launcher icon is displayed instead of my own.


Solution

  • The answer is short and simple: Reboot your phone!

    MIUI caches notification icons and after installing application they are not updated along with app updates(often during developing cycle). Also uninstalling and installing again does not resolve the problem. The only way in this case was to reboot the phone.

    I also suspect MIUI theme manager which may be responsible for this as I saw some themes changing app icons system-wide, so it may probably bypass any settings made in Notification.Builder. On top of that, any of the tricks like changing resources in RemoteView of built notification also does not work. Beware of MIUI!