Notification icons
Icons are a way to provide a more unique, branded experience to your notifications.
Android (including Amazon and Huawei) provides several options for setting up icons which this guide details in full. Android also supports Conversation Notifications that allow you to change the icon to the user's profile image.
iOS notifications use the same image as your app icon and cannot be changed without changing your app icon. iOS also support Communication Notifications that allow you to change the icon to the user's profile image.
Web push notifications, see Web push setup.
Android notification icons
Android supports both Small and Large Notification Icons.
Small notification icons
The small icon is displayed on the top status bar as well as the notification itself. By default OneSignal will show a bell icon, however we recommend you customize this so subscribers recognize it's a notification from your app.
Most Android devices only support alpha channel for the icon. It will display monochrome in the status bar, but an accent color can be applied to the left side of the notification itself.
Large notification icons
The large notification icon will show up to the left of the notification text on Android 4.0.3 - 6.0 devices and to the right for Android 7.0+ devices. If you do not set a large icon, the small icon will be used instead. OneSignal will auto scale large notification icons for you to prevent the icon from being cropped. The recommended size of the large icon is 256x256
pixels.
How to add default icons
We strongly recommend adding default icons to every Android and Amazon app.
1. Generate icons
REQUIRED: Add every icon size listed below
You must add each image with listed size and alpha transparency.
For help generating images with alpha transparency, see this clipart link for examples in the Android Asset Studio.
Option A: Using Android Asset Studio
Recommended
To quickly and easily generate small icons with the correct settings, we recommend using the Android Asset Studio. Use ic_stat_onesignal_default
as the name.
Option B: Manually create icons
If you prefer to create your own icons, you must make your icons the following sizes and make the small ones in white with a transparent background.
You must be sure the icon filenames are correct for Native, Unity, PhoneGap, Cordova, Ionic, PhoneGap Build (PGB), Xamarin, React Native, and Ionic Package (Cloud Build).
Note: If you used Android Asset Studio for your small icon then this step may have already been done for you.
Default icon name, density, size
Required: Each name and pixel size must be present in the app.
Name | Density (dp) | Size (px) |
---|---|---|
ic_stat_onesignal_default | MDPI | 24x24 |
ic_stat_onesignal_default | HDPI | 36x36 |
ic_stat_onesignal_default | XHDPI | 48x48 |
ic_stat_onesignal_default | XXHDPI | 72x72 |
ic_stat_onesignal_default | XXXHDPI | 96x96 |
ic_onesignal_large_icon_default.png | XXXHDPI | 256x256 |
If using Solar2D/Corona the file names and sizes are different, as follows:
Type | Density (dp) | Size (px) |
---|---|---|
IconNotificationDefault-ldpi.png | LDPI | 16x16 |
IconNotificationDefault-mdpi.png | MDPI | 24x24 |
IconNotificationDefault-hdpi.png | HDPI | 36x36 |
IconNotificationDefault-xhdpi.png | XHDPI | 48x48 |
IconNotificationDefault-xxhdpi.png | XXHDPI | 72x72 |
ic_onesignal_large_icon_default.png | N/A | 256x256 |
2. Create project paths
Make sure the following paths exist; create any folders you are missing.
Required: Each image must be present in the following paths:
SDK | File path |
---|---|
Android Native | res/drawable-mdpi/ (24x24)res/drawable-hdpi/ (36x36)res/drawable-xhdpi/ (48x48)res/drawable-xxhdpi/ (72x72)res/drawable-xxxhdpi/ (96x96)res/drawable-xxxhdpi/ (256x256) (Large Icon) |
Unity | Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/drawable-mdpi/ (24x24)Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/drawable-hdpi/ (36x36)Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/drawable-xhdpi/ (48x48)Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/drawable-xxhdpi/ (72x72)Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/drawable-xxxhdpi/ (96x96)Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/drawable-xxxhdpi/ (256x256) (Large Icon) |
PhoneGap, Cordova, Ionic, Intel XDK | <project-root>/platforms/android/app/src/main/res/drawable-mdpi/ (24x24)<project-root>/platforms/android/app/src/main/res/drawable-hdpi/ (36x36)<project-root>/platforms/android/app/src/main/res/drawable-xhdpi/ (48x48)<project-root>/platforms/android/app/src/main/res/drawable-xxhdpi/ (72x72)<project-root>/platforms/android/app/src/main/res/drawable-xxxhdpi/ (96x96)<project-root>/platforms/android/app/src/main/res/drawable-xxxhdpi/ (256x256) (Large Icon) |
PhoneGap Build (PGB), Ionic Package (Cloud Build) | <project-root>/locales/android/drawable-mdpi/ (24x24)<project-root>/locales/android/drawable-hdpi/ (36x36)<project-root>/locales/android/drawable-xhdpi/ (48x48)<project-root>/locales/android/drawable-xxhdpi/ (72x72)<project-root>/locales/android/drawable-xxxhdpi/ (96x96)<project-root>/locales/android/drawable-xxxhdpi/ (256x256) (Large Icon)See this github link for more details on the directory structure if you're having issues. |
React Native | android/app/src/main/res/drawable-mdpi/ (24x24)android/app/src/main/res/drawable-hdpi/ (36x36)android/app/src/main/res/drawable-xhdpi/ (48x48)android/app/src/main/res/drawable-xxhdpi/ (72x72)android/app/src/main/res/drawable-xxxhdpi/ (96x96)android/app/src/main/res/drawable-xxxhdpi/ (256x256) (Large Icon) |
Corona | Add files to root (all sizes) |
.NET Maui | Resources/Images/drawable-mdpi/ (24x24)Resources/Images/drawable-hdpi/ (36x36)Resources/Images/drawable-xhdpi/ (48x48)Resources/Images/drawable-xxhdpi/ (72x72)Resources/Images/drawable-xxxhdpi/ (96x96)Resources/Images/drawable-xxxhdpi/ (256x256) (Large Icon)Screenshot |
Issue with Older Versions of Cordova
With versions of Cordova before 7.0, you will need to use
<project-root>/platforms/android/res/drawable-{size}/
instead of the path shown above when adding the icon resource toconfig.xml
Troubleshooting Icons Not Showing
If you see the default OneSignal bell icon, you did not add all icon sizes. Please add all icon sizes and correct paths.
If you see a solid square, you set the image to the correct path, but the image does not have alpha transparency. For more help, try using images from this Android Asset Studio clipart.
Your project should look similar to this depending on your SDK:
Done!
You should be all set with your new default icons.
How to add non-default icons
Optional
After you've added your default icons, you may choose to add more non-default icons. These will let you show different icons depending on the types of notifications your app sends. For instance, a game with a title like "Jewel Breaker" may wish to have a different colored jewel icon for every notification sent that represents the user's level. Meanwhile, a social network may wish to show a chat bubble icon when the user receives a message from another user to differentiate those notifications from more generic system notifications.
OneSignal supports overriding default icons on a per-message basis.
1. Generate icons
Follow the steps above to generate icons and place them in the appropriate folder for your SDK.
2. Name non-default icons
To add non-default icons, you must name them something other than the default names specified above. For instance, you may name one message_icon
.
3. Send notifications with non-default icons
If you've followed the above steps for creating default icons and have updated your app, you'll be able to reference those icons when you send a notification. To send a notification with a custom icon:
Dashboard
Navigate to Messages > New Push > Platform Settings > Google Android Options > Set the icon name without the file extension. With Large Notification Icons, you can also supply a URL where the icon will be displayed from.
REST API
Set notification icons with the small_icon
and large_icon
REST API properties. Set the icon name without the file extension. More details in Create notification REST API docs.
Small icon accent color
You can change the color shown around the small icon of the notification.
Set Small Icon accent color
To set a default color, add the following line to your res/values/strings.xml
file in your project.
If you want a different color for dark mode, add the key to your res/values-night/strings.xml
as well.
Use the HEX value. Use Android Asset Studio Color scheme for assistance.
<resources>
<string name="onesignal_notification_accent_color">FF00FF00</string>
</resources>
To set the color on per notification bases, set android_accent_color
on our Create notification API call or enter a value in the Accent color field under Messages > New Push > Platform Settings > Google Android Options.
New icons take a while to propagate to all subscriptions
If you've very recently added an icon resource to your app, you may want to wait a few days before sending notifications using the icon. This is because it can take many days or even weeks for the majority of your users to update their apps to the latest version which contain your new icons.
Custom non-alpha channel small icon images
Some device manufactures display the image as-is (basically ignoring the alpha channel rule). You can setup a custom notification layout based on Android's documentation if you wish to use non-alpha channel images across all devices.
We highly recommend following the alpha rule as the icons may not look consistent on all devices. Google designed it this way — the icon is too small to see any meaningful detail, so enforcing a single color helps enforce an easier to recognize icon at a glance.
Updated 12 days ago