Class NotificationSDKClient
- java.lang.Object
-
- com.vasco.digipass.sdk.utils.notification.client.NotificationSDKClient
-
public class NotificationSDKClient extends java.lang.Object
This class provides the main functions of the Notification SDK Client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
NotificationSDKClient.NotificationSDKClientListener
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
VERSION
Version of the Notification SDK
-
Constructor Summary
Constructors Constructor Description NotificationSDKClient()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>
getCustomAttributes(android.content.Intent notification)
Parses the notification provided as an Android Intent and returns the custom attributes as an HashMap.static boolean
isForegroundNotification(android.content.Intent intent)
Check if the provided intent is a foreground notification.static boolean
isVASCONotification(android.content.Intent notification)
Check if the provided intent is a valid VASCO notification.static java.lang.String
parseVASCONotification(android.content.Intent notification)
Parses the notification provided as an Android Intent and returns the associated content as a String.static void
registerNotificationService(android.content.Context context, NotificationSDKClient.NotificationSDKClientListener notificationSDKClientListener)
Registers to the Firebase Cloud Messaging service.
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
Version of the Notification SDK- See Also:
- Constant Field Values
-
-
Method Detail
-
registerNotificationService
public static void registerNotificationService(android.content.Context context, NotificationSDKClient.NotificationSDKClientListener notificationSDKClientListener)
Registers to the Firebase Cloud Messaging service. This function should be called at every application start to update the identifier in the backend, if needed. Additionally, make sure that a onespan-notifications.properties file is present in the asset folder. This file must contain two key/value pairs:- notificationMIMEType: mime type that will be used when a notification is received. This must be the same value than the one specified inside the manifest.
- notificationIconName: icon displayed on the notification center when a notification is received. This icon must be added as a resource.
- Parameters:
context
- The context of the application.notificationSDKClientListener
- The Listener which return registrationIdentifier or error code.NotificationSDKClientErrorCodes.INTERNAL_ERROR
if an internal error occurred.NotificationSDKClientErrorCodes.NETWORK_NOT_AVAILABLE
if the network is not available.NotificationSDKClientErrorCodes.GOOGLEPLAYSERVICES_NOT_AVAILABLE
if the Google Play Services are not available.NotificationSDKClientErrorCodes.CONTEXT_NULL
if the context parameter is null.NotificationSDKClientErrorCodes.PROPERTIES_FILE_ERROR
if there is an error with the properties file.NotificationSDKClientErrorCodes.FCM_GET_INSTANCE_ERROR
if there is an error when FCM is not able to generate an instance.NotificationSDKClientErrorCodes.FCM_GENERATE_TOKEN_ERROR
if there is an error when FCM is not able to generate a token.
-
parseVASCONotification
public static java.lang.String parseVASCONotification(android.content.Intent notification) throws NotificationSDKClientException
Parses the notification provided as an Android Intent and returns the associated content as a String.- Parameters:
notification
- The intent provided by the system.- Returns:
- the content of the message associated with the notification that has been parsed. Null if nothing to parse.
- Throws:
NotificationSDKClientException
-NotificationSDKClientErrorCodes.NOTIFICATION_NULL
if notification is Null.NotificationSDKClientErrorCodes.NOTIFICATION_INVALID
if notification is invalid.
-
getCustomAttributes
public static java.util.Map<java.lang.String,java.lang.String> getCustomAttributes(android.content.Intent notification) throws NotificationSDKClientException
Parses the notification provided as an Android Intent and returns the custom attributes as an HashMap.- Parameters:
notification
- The intent provided by the system.- Returns:
- the content of the message associated with the notification that has been parsed. Empty map if nothing to parse.
- Throws:
NotificationSDKClientException
-NotificationSDKClientErrorCodes.NOTIFICATION_NULL
if notification is Null.NotificationSDKClientErrorCodes.NOTIFICATION_INVALID
if notification is invalid.
-
isVASCONotification
public static boolean isVASCONotification(android.content.Intent notification) throws NotificationSDKClientException
Check if the provided intent is a valid VASCO notification.- Parameters:
notification
- The intent provided by the system.- Returns:
- true if the provided intent is a valid VASCO notification, false otherwise.
- Throws:
NotificationSDKClientException
-NotificationSDKClientErrorCodes.INTERNAL_ERROR
if an internal error occurred.
-
isForegroundNotification
public static boolean isForegroundNotification(android.content.Intent intent)
Check if the provided intent is a foreground notification. This is used only when enabling the 'notificationOpenInForeground' feature.- Parameters:
intent
- The intent provided by the system.- Returns:
- true if the notification is received from the server while the app is in foreground. false otherwise,
-
-