How to Customize Notification Handling
The SDK allows customizations of notifications via the NotificationCustomizationOptions class. The example shown in the Initialize the SDK portion of the documentation requires only that the
Small Icon Resource ID be provided to the SDK. This is the minimum configuration for showing notifications with the Marketing Cloud Mobile Push SDK. See Google’s documentation regarding Status Bar Icons.
You can customize notifications further by providing a Launch Intent Provider and/or instructing the SDK what action to take when a notification is tapped. See the Simplified Customization section below. You may also take complete control of the notification. See the Full Control Customization section at the end of this page.
The NotificationMessage class can be leveraged to facilitate customizations like “Deep Linking” or handling Custom Keys.
NotificationCustomizationOptions can be created with a NotificationChannelIdProvider to customize the channel for a NotificationMessage and a NotificationLaunchIntentProvider to customize the action that will be taken when a NotificationMessage is tapped in addition to your application’s Notification Icon.
Full Control Customization
When providing a builder to the NotificationCustomizationOptions you will be responsible for all aspects of the notification’s display properties and tap actions. This includes Notification Channel creation, Launch Intent action, etc. You can access the NotificationCompat.Builder that would have been used by the SDK and leverage that as a baseline to modify. You may also have the SDK create a default NotificationChannel for your application.
NOTE: You must wrap your
PendingIntentin the SDK’s analytics helper method NotificationManager.redirectForAnalytics() if you wish to have the Marketing Cloud collect notification open analytics for your notifications.