ICNotificationFactory
This class is responsible for creating local notifications for display on the device. By default, the SDK will only produce notifications for Push messages.
Customisations may be introduced by inheriting from this class and overriding onBuildNotification
and getActionIconId
.
It is possible to completely replace the default notification generation by overriding
createNotification
instead ofonBuildNotification
. In this instance you are responsible for building the complete notification and will not get any of the pre-built interactive message functionality.
createNotification
This method is invoked whenever the SDK needs to generate a notification for an incoming message. Override this method to completely replace the notification generation process. To stop notifications from being displayed it is valid to return null from this method.
โโSyntax: Notification createNotification(Context context, ICMessage message, int notificationId, Bitmap bigPicture)
โโParameters:
Parameter | Type | Description |
---|---|---|
context | Context | Refer to Android Context. |
message | ICMessage | The message for which to create a notification. |
notificationId | int | The id to assign to the notification. |
bigPicture | Bitmap | Specifies a bitmap for big picture notifications. |
โโReturn Value: Returns an Android notification.
createNotification
This method is invoked whenever the SDK needs to generate a notification for an incoming message. Override this method to completely replace the notification generation process. To stop notifications from being displayed it is valid to return null from this method.
โโSyntax: Notification createNotification(Context context, ICMessage message, int notificationId, Bitmap bigPicture)
โโParameters:
Parameter | Type | Description |
---|---|---|
context | Context | Refer to Android Context. |
message | ICMessage | The message for which to create a notification. |
notificationId | int | The id to assign to the notification. |
bigPicture | Bitmap | Specifies a bitmap for big picture notifications. May be null. |
largeIcon | Bitmap | A bitmap to be used for the large icon property of the notification. May be null. |
โโReturn Value:
โReturns an Android notification.
getActionIconId
Override this method to return a drawable resource id to be used for an interactive message action.
โโSyntax: int getActionIconId(String action, String identifier, ICMessage message)
โโParameters:
Parameter | Type | Description |
---|---|---|
action | String | Specifies the interactive notification action. See the Messaging API Reference for more details. |
identifier | String | Specifies the interactive action identifier. See the Messaging API Reference for more details. |
message | ICMessage | The message for which a notification is being built. |
โโReturn Value:
โThe resource id for the icon.
onBuildNotification
This method is invoked at the end of the SDK notification build process and may be used to customize the standard notifications.
โโSyntax: void onBuildNotification(Context context, NotificationCompat.Builder builder, ICMessage message, int notificationId)
โโParameters:
Parameter | Type | Description |
---|---|---|
context | Context | A valid Android Context instance. |
builder | NotificationCompat.Builder | The Android NotificationCompat.Builder instance. Used to introduce customization to the notification. |
message | ICMessage | The message for which a notification is being built. |
notificationId | integer | The unique id of the notification. |
Updated about 1 year ago