Package com.iterable.iterableapi
Class IterableNotificationBuilder
java.lang.Object
androidx.core.app.NotificationCompat.Builder
com.iterable.iterableapi.IterableNotificationBuilder
public class IterableNotificationBuilder
extends androidx.core.app.NotificationCompat.Builder
Created by David Truong [email protected]
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedIterableNotificationBuilder(android.content.Context context, java.lang.String channelId)Creates a custom Notification builder -
Method Summary
Modifier and Type Method Description android.app.Notificationbuild()Combine all of the options that have been set and return a newNotificationobject.static IterableNotificationBuildercreateNotification(android.content.Context context, android.os.Bundle extras)Creates and returns an instance of IterableNotification.voidcreateNotificationActionButton(android.content.Context context, com.iterable.iterableapi.IterableNotificationData.Button button, android.os.Bundle extras)Creates a notification action button for a given JSON payloadbooleanisGhostPush()static voidpostNotificationOnDevice(android.content.Context context, IterableNotificationBuilder iterableNotificationBuilder)Posts the notification on device.voidsetExpandedContent(java.lang.String content)Sets the expanded content used for backwards compatibility up to Android API 23voidsetImageUrl(java.lang.String imageUrl)Sets the image urlvoidsetIsGhostPush(boolean ghostPush)Methods inherited from class androidx.core.app.NotificationCompat.Builder
addAction, addAction, addExtras, addInvisibleAction, addInvisibleAction, addPerson, extend, getBigContentView, getColor, getContentView, getExtras, getHeadsUpContentView, getNotification, getPriority, getWhenIfShowing, limitCharSequenceLength, setAutoCancel, setBadgeIconType, setCategory, setChannelId, setColor, setColorized, setContent, setContentInfo, setContentIntent, setContentText, setContentTitle, setCustomBigContentView, setCustomContentView, setCustomHeadsUpContentView, setDefaults, setDeleteIntent, setExtras, setFullScreenIntent, setGroup, setGroupAlertBehavior, setGroupSummary, setLargeIcon, setLights, setLocalOnly, setNumber, setOngoing, setOnlyAlertOnce, setPriority, setProgress, setPublicVersion, setRemoteInputHistory, setShortcutId, setShowWhen, setSmallIcon, setSmallIcon, setSortKey, setSound, setSound, setStyle, setSubText, setTicker, setTicker, setTimeoutAfter, setUsesChronometer, setVibrate, setVisibility, setWhen
-
Constructor Details
-
IterableNotificationBuilder
protected IterableNotificationBuilder(android.content.Context context, java.lang.String channelId)Creates a custom Notification builder- Parameters:
context-channelId-
-
-
Method Details
-
setImageUrl
public void setImageUrl(java.lang.String imageUrl)Sets the image url- Parameters:
imageUrl-
-
setExpandedContent
public void setExpandedContent(java.lang.String content)Sets the expanded content used for backwards compatibility up to Android API 23- Parameters:
content-
-
setIsGhostPush
public void setIsGhostPush(boolean ghostPush) -
isGhostPush
public boolean isGhostPush() -
build
public android.app.Notification build()Combine all of the options that have been set and return a newNotificationobject. Download any optional images- Overrides:
buildin classandroidx.core.app.NotificationCompat.Builder
-
createNotificationActionButton
public void createNotificationActionButton(android.content.Context context, com.iterable.iterableapi.IterableNotificationData.Button button, android.os.Bundle extras)Creates a notification action button for a given JSON payload- Parameters:
context- Contextbutton- `IterableNotificationData.Button` object containing button informationextras- Notification payload
-
createNotification
public static IterableNotificationBuilder createNotification(android.content.Context context, android.os.Bundle extras)Creates and returns an instance of IterableNotification. This is kept here for backwards compatibility.- Parameters:
context-extras-- Returns:
- Returns null if the intent comes from an Iterable ghostPush or it is not an Iterable notification
-
postNotificationOnDevice
public static void postNotificationOnDevice(android.content.Context context, IterableNotificationBuilder iterableNotificationBuilder)Posts the notification on device. Only sets the notification if it is not a ghostPush/null iterableNotification. This is kept here for backwards compatibility.- Parameters:
context-iterableNotificationBuilder- Function assumes that the iterableNotification is a ghostPush if the IterableNotification passed in is null.
-