Integrate the Notification SDK Client

Prev Next

Android

The SDK is delivered in two formats, as

  • AAR file, embedding an AndroidManifest.xml file, so less information is required in the AndroidManifest.xml of the application

  • Local Maven repository with transitive dependencies.

    This repository also includes a documentation jar file to view the technical documentation in Android Studio (to be used in conjunction with the repository)

AAR artifact-based integration

To integrate the Notification SDK Client into your Android project via aar file

  1. Copy NotificationSDKClient.aar from the OneSpan Mobile Security Suite package to your project.

  2. Add the Google Play services project as a dependent library.

    For more information, refer to the Firebase documentation.

  3. Configure your manifest to be able to receive a notification.

    <application>
                        <activity android:name="ActivityName">
                        ...
                        <!-- This intent filter is used to select the activity that
                        will be launched when the user clicks on a notification.
                        The MIME type is customizable. Make sure it matches the
                        “notificationMIMEType” property in the assets/onespan-notifications.properties
                        file. -->
                        <intent-filter>
                        <action android:name="android.intent.action.VIEW"/>
                        <category android:name= "android.intent.category.DEFAULT"/>
                        <data android:mimeType= "application/vnd.com.vasco.notification.NOTIFICATION_ ACTIVITY"/>
                        </intent-filter>
                        </activity>
                        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
                        </application>

    If you target Android 13, you need to declare the POST_NOTIFICATIONS permission in the AndroidManifest.xml of the application.

  4. Create a onespan-notifications.properties file in the assets folder.

    This file must contain several properties, each of which has a key/value pair. The key and value are separated by an equal sign (=). For example:

    notificationMIMEType=application/vnd.com.vasco.notification.NOTIFICATION_ACTIVITY

    The following table lists the mandatory and optional properties to include in the file:

    Key

    Mandatory

    Description

    notificationMIMEType

    ✓

    Mime type that is used when a notification is received. This must be the same value as the one specified in the manifest.

    notificationIconName

    ✓

    Icon displayed in the notification center when a notification is received. This icon file must be in a .png format and must be added as a resource.

    notificationIconNameLollipop

    Icon displayed in the notification center when a notification is received. This property is used on Android 5.0 and later. The icon can only be white and transparent, must be in a .png format and must be added as a resource.

    notificationIconBackgroundColorLollipop

    Background color used for the notification icon when a notification is displayed on the notification drawer. This property is used on Android 5.0 and later. Supported formats are:

    • #RRGGBB

    • #AARRGGBB,

    • or you can use the following color terms:

      red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray, darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy, olive, purple, silver, teal.

    notificationOpenInForeground

    Optional Boolean switching behavior of the notifications that are received while the application is in foreground. Default value: false.

    notificationTargetClass

    Defines the class to use as the target for the notification.

    notificationMIMEType=application/vnd.com.vasco.notification.NOTIFICATION_ACTIVITY
                        notificationIconName=ic_notification.png
                        notificationIconNameLollipop=ic_notification_lollipop.png
                        notificationIconBackgroundColorLollipop=#848484
                        notificationOpenInForeground=true
                        notificationTargetClass=com.vasco.digipass.sdk.utils.notification.client.sample.NotificationSDKClientSampleActivity
  5. Retrieve google-services.json from your Firebase project. This file is mandatory to enable FCM from your Android project. For more information about obtaining this file, see Enable Push Notification in a Google project. This file must be downloaded from your Firebase project:

    • Go to Console -> Select Project -> Project Settings and open the General tab.

    • Retrieve google-services.json and replace the .json file inside the app sample project repository.

You are now ready to use the Notification SDK Client.

Integrating the Notification SDK Client (Android)

Integrate the Notification SDK Client (Android)

Maven-based integration

The SDK artifact is also delivered as a local Maven repository with transitive dependencies, and the package includes a documentation jar file to view the technical documentation in Android Studio (to be used in conjunction with the Maven repository).

To integrate the SDK via maven repository:

  1. Copy the maven folder from the published artifacts to the root folder of your application.

  2. Define the dependency in your build.gradle file: implementation 'com.onespan:sdk_notification_client_android:+'.

  3. Comment out any existing definitions, for example: implementation(name: 'NotificationSDKClient', ext: 'aar').

Threading

The following methods need to be called on a background thread:

  • registerNotificationService

  • isVASCONotification

iOS

To integrate the Notification SDK Client into your iOS project

  1. Link MSSNotificationClient.xcframework from the OneSpan Mobile Security Suite package to your Xcode project (linked framework and libraries).

  2. In your .plist file, add the App downloads content in response to push notifications mode (raw value: <remote-notification>) to the list associated with the Required background modes property (raw value: UIBackGroundModes).

  3. Make sure your application bundle identifier matches that in the provisioning profile that has been created for this specific application with the Remote notifications capability.

You are now ready to use the Notification SDK Client.

Integration client SDK: Xcode Info.plist editor with Required background modes set to remote-notification content downloads

Integrate the Notification SDK Client (iOS)

API reference documentation and sample applications

To learn more about the public APIs and their functions, exceptions, and error codes, refer to the technical documentation that is included in the product package for each SDK and each platform. In the product package, you can also find the sample applications provided for each platform to see examples of how the SDKs can be used.

These sample apps are intended only to demonstrate basic scenarios and SDK usage. They are not designed to be copied directly into production projects!