Android Mobile App Notifications Only
This section is for Android Mobile app customizations only. If you have a website, please see our Web Push Customizations guide.
Read more on the Android Notification Icons page.
Notification categories are a new Android Oreo (8.0) feature which gives users finer control over notifications. You can select a category from Android Options or API
android_channel_id when Sending Push Messages. To learn more about how Android Categories see Android Notification Categories.
Android 4.1 and newer devices support actions buttons. You can specify up to 3 buttons that will display below your notification content. See Action Buttons.
See Images & Rich Media.
Certain Android hardware devices have LED notification lights built-in, allowing notifications to trigger a colored notification light on a device upon receipt. Notification colors may be set on a per-message basis in the OneSignal dashboard, or via the OneSignal SDK/API.
Notification colors are set using ARGB Hex values (e.g. a red LED notification light would be in the format
FF99000). If LED Color is not set, the light uses the device's default color.
Accent colors only apply to apps targeting Android API level 21+ running on Android 5.0+ devices.
Accent colors are the background color around your small icon, which appears to the left of the notification content in a notification. Like LED Colors, accent colors may be set with an ARGB Hex value in either the dashboard or SDK/API. If Accent Color is not set, the color is set to grey. Read more in Android Notification Icons
Android supports grouping or combining notifications together.
See Notification Grouping for more details.
The OneSignal SDK automatically sets the badge count on your app to the number of notifications that are currently in the notification shade.
See our Android Badges Guide for more details on the behavior and on how you can disable this.
Read more in Customize Notification Sounds
When a notification is tapped on OneSignal will resume your app, or open your launcher Activity if your app was swiped away. If you have set a launch URL OneSignal will also open it. See URLs, Links and Deep Links if you want to only customize this behavior.
If you want to fully disable all automatic open behaviors of your OneSignal notifications add the following to your
<application ...> <meta-data android:name="com.onesignal.NotificationOpened.DEFAULT" android:value="DISABLE" /> </application>
Make sure you are initializing OneSignal with setNotificationOpenedHandler in the
onCreate method in your
Application class. You will need to call
startActivity from this callback to take the user to your intended
OneSignal supports sending additional data along with a notification as key value pairs. You can read this additional data when a notification is opened by adding a setNotificationOpenedHandler instead.
However, if you want to one of the following...
- Receive data in the background with or without displaying a notification.
- Override specific notification settings depending on client-side app logic such as custom accent color, vibration pattern, or other any other
NotificationCompatoptions available. See Android's documentation on the NotificationCompat options.
...continue with the instructions in our Service Extensions Setup.
To support notifications with right-to-left languages correctly you must add
android:supportsRtl="true" to your
<application> tag in your
<application android:supportsRtl="true" android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme" android:label="OneSignal Example" android:name=".OneSignalExampleApp"> ... </application>
Note, make sure to test all your Activities as this effect all views in your app.
Updated 23 days ago