Class Notification
- java.lang.Object
-
- com.vasco.digipass.sdk.utils.notification.server.Notification
-
public class Notification extends java.lang.Object
The Notification object contains all the elements (title, subject...) to build a notification ready to be sent to the user device. It must be provided to theNotificationSDKServer.sendNotification(String, Notification)
method.
-
-
Constructor Summary
Constructors Constructor Description Notification(java.lang.String title, java.lang.String subject, java.lang.String content)
Creates aNotification
object from its mandatory attributes.Notification(java.lang.String title, java.lang.String subject, java.lang.String content, boolean isHighPriority)
Creates aNotification
object from its mandatory attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCustomAttribute(java.lang.String key, java.lang.String value)
Adds a custom attributes to the notification.java.lang.String
getContent()
Gets the content of the notification.java.util.Map<java.lang.String,java.lang.String>
getCustomAttributes()
Gets the tracking identifier used to differentiate the notifications in the error/success callbacks.int
getIdentifier()
Gets the notification identifier of the notification.int
getIOSBadge()
(iOS only).java.lang.String
getiOSBundleId()
(iOS only).java.lang.String
getPriority()
Gets the priority of the notification.java.lang.String
getSubject()
Gets the subject of the notification.java.util.Date
getTimeToLive()
Gets the time to live of the notification.java.lang.String
getTitle()
Gets the title of the notification.int
getTrackingIdentifier()
Gets the tracking identifier used to differentiate the notifications in the error/success callbacks.boolean
isAndroidDryRun()
(Android only).boolean
isAndroidHeadsUp()
(Android only).void
setAndroidDryRun(boolean dryRun)
(Android only).void
setAndroidHeadsUp(boolean androidHeadsUp)
(Android only).void
setContent(java.lang.String content)
Sets the content of the notification.void
setIdentifier(int identifier)
Sets the notification identifier of the notification.void
setIOSBadge(int badge)
(iOS only).void
setiOSBundleId(java.lang.String bundleId)
(iOS only).void
setSubject(java.lang.String subject)
Sets the subject of the notification.void
setTimeToLive(java.util.Date timeToLive)
Sets the time to live of the notification.void
setTitle(java.lang.String title)
Sets the title of the notification.void
setTrackingIdentifier(int trackingIdentifier)
Sets the tracking identifier used to differentiate the notifications in the error/success callbacks.
-
-
-
Constructor Detail
-
Notification
public Notification(java.lang.String title, java.lang.String subject, java.lang.String content, boolean isHighPriority)
Creates aNotification
object from its mandatory attributes.- Parameters:
title
- text to be displayed as title of the notification. Must not be null. On iOS, the title must not contain any '\n' charactersubject
- text to be displayed as subject of the notification. Must not be null.content
- text to be used as content of the notification. Will be provided to the client application once the notification has been opened. Must not be null.isHighPriority
- boolean to be used to set notification priority.
-
Notification
public Notification(java.lang.String title, java.lang.String subject, java.lang.String content)
Creates aNotification
object from its mandatory attributes.- Parameters:
title
- text to be displayed as title of the notification. Must not be null. On iOS, the title must not contain any '\n' charactersubject
- text to be displayed as subject of the notification. Must not be null.content
- text to be used as content of the notification. Will be provided to the client application once the notification has been opened. Must not be null.
-
-
Method Detail
-
getIdentifier
public int getIdentifier()
Gets the notification identifier of the notification.- Returns:
- the notification identifier of the notification
-
setIdentifier
public void setIdentifier(int identifier)
Sets the notification identifier of the notification.- Parameters:
identifier
- the notification identifier of the notification
-
getContent
public java.lang.String getContent()
Gets the content of the notification.- Returns:
- the content of the notification
-
setContent
public void setContent(java.lang.String content)
Sets the content of the notification.- Parameters:
content
- the content of the notification to set
-
getTitle
public java.lang.String getTitle()
Gets the title of the notification.- Returns:
- the title of the notification
-
setTitle
public void setTitle(java.lang.String title)
Sets the title of the notification.- Parameters:
title
- the title of the notification to set
-
getSubject
public java.lang.String getSubject()
Gets the subject of the notification.- Returns:
- the subject of the notification
-
getPriority
public java.lang.String getPriority()
Gets the priority of the notification.- Returns:
- the priority of the notification
-
setSubject
public void setSubject(java.lang.String subject)
Sets the subject of the notification.- Parameters:
subject
- the subject of the notification to set
-
addCustomAttribute
public void addCustomAttribute(java.lang.String key, java.lang.String value)
Adds a custom attributes to the notification.- Parameters:
key
- the key of the attributevalue
- the value of the attribute
-
getCustomAttributes
public java.util.Map<java.lang.String,java.lang.String> getCustomAttributes()
Gets the tracking identifier used to differentiate the notifications in the error/success callbacks.- Returns:
- the tracking identifier used to differentiate the notifications in the error/success callbacks
-
getTrackingIdentifier
public int getTrackingIdentifier()
Gets the tracking identifier used to differentiate the notifications in the error/success callbacks.- Returns:
- the tracking identifier used to differentiate the notifications in the error/success callbacks
-
setTrackingIdentifier
public void setTrackingIdentifier(int trackingIdentifier)
Sets the tracking identifier used to differentiate the notifications in the error/success callbacks.- Parameters:
trackingIdentifier
- the tracking identifier used to differentiate the notifications in the error/success callbacks
-
setIOSBadge
public void setIOSBadge(int badge)
(iOS only).Sets the notification badge to be displayed next to the application icon.
If the badge value is negative, no badge will be sent in the notification, and the badge of the application icon (if there is one) will not be changed.
If the badge value is 0, the notification badge will be removed.
Default value is -1 (no badge sent).
- Parameters:
badge
- The number to display as the badge of the application icon
-
getIOSBadge
public int getIOSBadge()
(iOS only).Gets the notification badge to be displayed next to the application icon.
- Returns:
- the number to display as the badge of the application icon.
-
setAndroidHeadsUp
public void setAndroidHeadsUp(boolean androidHeadsUp)
(Android only).Sets the android notification to be heads-up.
- Parameters:
androidHeadsUp
- true to set the notification as heads-up.
-
isAndroidHeadsUp
public boolean isAndroidHeadsUp()
(Android only).Indicates if the android notification is heads-up or not.
- Returns:
- true if the notification is heads-up.
-
setiOSBundleId
public void setiOSBundleId(java.lang.String bundleId)
(iOS only).Sets the bundle ID of the application targeted by the notification.
- Parameters:
bundleId
- the targeted application's bundle ID.
-
getiOSBundleId
public java.lang.String getiOSBundleId()
(iOS only).Gets the bundle ID of the application targeted by the notification.
- Returns:
- the targeted application's bundle ID.
-
getTimeToLive
public java.util.Date getTimeToLive()
Gets the time to live of the notification.- Returns:
- the time to live of the notification
-
setTimeToLive
public void setTimeToLive(java.util.Date timeToLive)
Sets the time to live of the notification.- Parameters:
timeToLive
- the time to live of the notification
-
setAndroidDryRun
public void setAndroidDryRun(boolean dryRun)
(Android only).Sets the dry-run option of the call. Set to 1 in order to validate the notification on the server without sending it to the device.
- Parameters:
dryRun
- true to set the notification call as dry-run
-
isAndroidDryRun
public boolean isAndroidDryRun()
(Android only).Indicates if the notification call is dry-run or not.
- Returns:
- true if the notification call is dry-run.
-
-