Android notifications different icon for status bar and notification body

I have a notification of battery level. I want to make different icon in status bar and notifications center. In status bar: number (2 digits). In body: my app icon. How can I do that? The app icon is also in the status bar, how can I change that?

Answers


I'm not sure what your code looks like right now but I'd do something like this:

Notification.Builder nb = new Notification.Builder(context)
.setContentTitle("title")
.setContentText("content")
.setAutoCancel(true)
.setLargeIcon(R.drawable.large_icon)
.setSmallIcon(R.drawable.small_icon)
.setTicker("ticker text");
NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(100, nb.build());

Note the setLargeIcon() and setSmallIcon(). The icon you want to show in the 'ticker' should be set in setSmallIcon() and for what you have called the 'notification centre', you should use setLargeIcon(). That should work.


Need Your Help

JavaScript set bits from the left

javascript binary bit-manipulation

I have a number, for example 128. Its bit representation is 10000000.

check and uncheck all the nodes of the tree view in c#

c# winforms treeview tabcontrol

I have the tree view in my windows application and in the tree view with the checkboxes and I have the Some "parent nodes" and some "child nodes" and i want to CHECK AND UNCHECK the parent and child