Braze Notification Utils
Functions
Creates a request to cancel a push notification in the notification center.
Returns an id for the new notification we'll send to the notification center. Notification id is used by the Android OS to override currently active notifications with identical ids. If a custom notification id is not defined in the payload, Braze derives an id value from the message's contents to prevent duplication in the notification center.
This method will retrieve notification priority from notificationExtras bundle if it has been set. Otherwise returns the default priority.
Returns the channel id for a valid NotificationChannel, creating one if necessary.
Returns an existing notification channel. The notification extras are first checked for a notification channel that exists. If not, then the default Braze notification channel is returned if it exists. If neither exist on the device, then null is returned.
Handles a request to cancel a push notification in the notification center. Called by BrazePushReceiver when a Braze cancel notification intent is received.
Parses the notification bundle for any associated ContentCards, if present. If found, the card object is added to card storage.
Handles a push notification deletion by the user. Called by BrazePushReceiver receiver when a Braze push notification delete intent is received.
Handles a push notification click. Called by BrazePushReceiver when a Braze push notification click intent is received.
Handles a push story page click. Called by BrazePushReceiver when an Braze push story click intent is received.
Checks the incoming notification intent to determine whether it is a Braze push message.
Checks the notification intent to determine whether this is a notification message or a silent push.
Returns true if the bundle is from a push sent by Braze for uninstall tracking. Uninstall tracking push can be ignored.
Checks whether the given integer value is a valid Android notification visibility constant.
Logs a notification click with Braze if the extras passed down indicate that they are from Braze and contain a campaign Id.
Checks that the notification is a story that has only just been received. If so, each image within the story is put in the Braze image loader's cache.
Refreshes a feature flags refresh from Braze if appropriate based on the payload of the push notification. The SDK will respect the rate limit for feature flag refreshes.
Requests a geofence refresh from Braze if appropriate based on the payload of the push notification.
Opens any available deep links with an Intent.ACTION_VIEW intent, placing the main activity on the back stack. If no deep link is available, opens the main activity.
Sends a push notification opened broadcast to the client broadcast receiver.
Creates and sends a broadcast message that can be listened for by the host app. The broadcast message intent contains all of the data sent as part of the Braze push message.
Set accent color for devices on Lollipop and above. We use the push-specific accent color if it exists in the notificationExtras, otherwise we search for a default set in braze.xml or don't set the color at all (and the system notification gray default is used).
Set category for devices on Lollipop and above. Category is one of the predefined notification categories (see the CATEGORY_* constants in Notification) that best describes a Notification. May be used by the system for ranking and filtering.
Sets notification content if it exists in the payload.
Create broadcast intent that will fire when the notification has been opened. BrazePushReceiver will be notified, log a click, then send a broadcast to the client receiver.
Set large icon. We use the large icon URL if it exists in the notificationExtras. Otherwise we search for a drawable defined in braze.xml. If that doesn't exists, we do nothing.
Sets the notification number, set via NotificationCompat.Builder.setNumber. On Android O, this number is used with notification badges.
Creates an alarm which will issue a broadcast to cancel the notification specified by the given notificationId after the given duration.
Sets the priority of the notification if a priority is present in the notification extras.
Set the public version of the notification for notifications with private visibility.
This method exists to disable NotificationCompat.Builder.setShowWhen for push stories.
Sets the icon used in the notification bar itself. If a drawable defined in braze.xml is found, we use that. Otherwise, fall back to the application icon.
Notifications can optionally include a sound to play when the notification is delivered.
Sets the subText of the notification if a summary is present in the notification extras.
Sets notification ticker to the title if it exists in the payload.
Set visibility for devices on Lollipop and above.
This method will wake the device using a wake lock if the android.Manifest.permission.WAKE_LOCK permission is present in the manifest. If the permission is not present, this does nothing. If the screen is already on, and the permission is present, this does nothing. If the priority of the incoming notification is min, this does nothing.
Properties
Returns a custom IBrazeNotificationFactory if set, else the default IBrazeNotificationFactory.
The Class of the notification receiver used by this application.