wesley franks
wesley franks

Reputation: 7195

Android Lollipop 5.0 Notification Icon Small, Large Bitmap

I wanted to create a question on how to create notification icons for an app. Then answer it.

I will be answering the following questions that I feel need to be grouped together in one explanation rather than spread across the inter web.

FIRST

What is a small icon in notification.builder?

SECOND

What is a large icon in notification.builder?

THIRD

How do I make a small, large icon for notifications?

Upvotes: 0

Views: 1064

Answers (2)

wesley franks
wesley franks

Reputation: 7195

1.)

To answer the first question we need to understand the design guidelines that Google has graciously made for Android.

GOOGLE DESIGN GUIDELINES

Watch the video that is located in the above link, in the section shown below. It will explain the design behind android's new notifications

enter image description here

A small icon is basically a context to what the app is trying to convey or it can be used to act as the main icon for all notifications, but know that you will not get a filled in SMALL ICON it will always be centered in the circle that is how Google has designed it.

For example I am building an app that will have many different notifications pushed to the user. However, I would like the main app icon to show as a large icon using Bitmap, but to help the users know the context and grow a habit of understanding that notification to be connected with a certain action in the app. The small icon would serve that purpose by providing a simple transparent white image.

A small icon is a completely white transparent image that has the main components of the graphic transparent to be shown on the notification tray, and when slid down.

2.)

Refer to the above link, video for the large icon reference.

A large icon can be the main app icon, or it can be an image downloaded from a data source. Preferably in my situation I use it as the main app icon. However, it can be anything in Facebook, Instagram use images downloaded from their servers to serve as context for who is commenting on a post, then Facebook uses their small icon to represent Facebook. Focusing on the user, rather than the app.

3.)

To make a small icon you will need to either consult a graphics designer or follow the icon size guide here.

For large icons that would depend on what you need exactly. Whether you want to use the app icon itself, or make one a bit more larger for example, Music player shows album art in a big size. Possibly using custom layouts.

Lastly, something I also really struggled with for a few days was the context. I kept getting Null Pointer Exception, and the app would crash. What was happening was I was using a fragment. I was passing context properly, however I was getting the context when the fragment was created, "OnCreate". This works both in fragments and activities. Those that have this issue in an activity do the same make sure your context is being initialized in the OnCreate.

mContext = getActivity(); For Fragments

mContext = MainActivity.this; For Activities

That is it, let me know if you have any questions or concerns. I am sure that I might be missing some info, or not explaining it entirely as Google would, but I was having tons of trouble so I wanted to make sure those that were struggling as I was could have something to help guide them.

Upvotes: 1

Midhun MP
Midhun MP

Reputation: 107231

Small Icon : Icon that will be shown in the status bar when your notification is fired

Small Icon

Large Icon : Icon that will be shown in the notification tray (When slides down). If large icon is missing, then the small icon is used for this purpose.

Large Icon

Refer Notification.Builder for more details.

For creating notification icons, you can use Notification Icon Generator of Android Asset Studio

Upvotes: 1

Related Questions