- 04 Dec 2024
- 3 Minutes to read
- DarkLight
- PDF
Integrate the Notification SDK Client
- Updated on 04 Dec 2024
- 3 Minutes to read
- DarkLight
- PDF
Android
The following procedure allows you to integrate and use the Notification SDK Client in your Android project.
To use the Notification SDK Client in your Android project
Copy NotificationSDKClient.aar from the OneSpan Mobile Security Suite package to your project.
Add the Google Play services project as a dependent library.
For more information, refer to https://firebase.google.com/docs/android/setup.
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.
As of version 4.17.2 of the OneSpan Notification SDK, the library is delivered as an AAR file.
The AAR file embeds an AndroidManifest.xml file; thus less information is required in the AndroidManifest.xml of the application.
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
Properties in the onespan-notifications.properties file lists the mandatory and optional properties to include in the file:
Properties in the onespan-notifications.properties 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.
notificationMIMEType=application/vnd.com.vasco.notification.NOTIFICATION_ACTIVITY notificationIconName=ic_notification.png notificationIconNameLollipop=ic_notification_lollipop.png notificationIconBackgroundColorLollipop=#848484 notificationOpenInForeground=true
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.
Integrate the Notification SDK Client (Android)
iOS
The following procedure allows you to integrate and use the Notification SDK Client in your iOS project.
To use the Notification SDK Client in your iOS project
Link MSSNotificationClient.xcframework from the OneSpan Mobile Security Suite package to your Xcode project (linked framework and libraries).
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) .
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.
Integrate the Notification SDK Client (iOS)