To integrate the ZendriveIQLUIKit library into your application, we recommend using dependency managers. For iOS, CocoaPods is the preferred choice, and for Android, Gradle is suggested. Please follow the platform-specific instructions provided below for further details.
iOS (Swift)
Add the ZendriveIQLUIKit dependency
Open your Podfile and add the following lines under your application's target:
# Zendrive SDK pod 'ZendriveSDK',:git=>'https://bitbucket.org/zendrive-root/zendrive_cocoapod.git',:tag=>'10.0.3' pod 'ZendriveSDKSwift',:git=>'https://bitbucket.org/zendrive-root/zendrive_cocoapod.git',:tag=>'10.0.3'# Zendrive UIKit pod 'ZendriveIQLUIKit',:git=>'https://bitbucket.org/zendrive-root/zendrive-iql-uikit.git',:tag=>'1.2.0'
Install the Dependency:
Save the Podfile and run the following command in terminal while still in your project directory.
pod install
This will install ZendriveIQLUIKit and any required dependencies.
Update Xcode Project Settings
Enable background modes.
On the Project Settings screen select your application's target.
Select Signing & Capabilities tab and find Background Modes. If Background Modes is not found, clickthe '+ Capability' button to search and add Background Modes.
Select Location updates and Remote notifications.
Disable Bitcode for your application as Zendrive SDK does not support Bitcode.
On the Project Settings screen select your application's target.
Click Build Settings.
Search for Enable Bitcode.
Ensure it is set to No.
Add Location and Motion usage description entries in Info.plist file.
Open Info.plist file.
Add NSLocationAlwaysUsageDescription,NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription entries. Consider using this copy Your precise location helps us to better determine your driving behavior even if you don't have the app open.
Add NSMotionUsageDescription entry. Consider using this copy Your activity information helps us to detect drives faster and more accurately.
<key>NSLocationAlwaysUsageDescription</key><string>Your precise location helps us to better determine your driving behavior even if you don't have the app open.</string><key>NSLocationWhenInUseUsageDescription</key><string>Your precise location helps us to better determine your driving behavior even if you don't have the app open.</string><key>NSLocationAlwaysAndWhenInUseUsageDescription</key><string>Your precise location helps us to better determine your driving behavior even if you don't have the app open.</string><key>NSMotionUsageDescription</key><string>Your activity information helps us to detect drives faster and more accurately.</string>
Android (Kotlin)
To include the ZendriveIQLUIKit library in your Android project, you need to add it as a dependency in your project's build.gradle file.
The following code adds the ZendriveIQLUIKit library as a dependency, allowing you to use its functionality in your Android application.
ZendriveIQLUIKit uses the MaterialComponents theme for UI components. Ensure that the base application theme derives from Theme.MaterialComponents.NoActionBar . If your application declares a base theme in app/src/main/res/values/styles.xml change parent theme as follows:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
Additional steps for Updating Xcode Project Settings:
Enable background modes
On the Project Settings screen select your application's target.
Select Signing & Capabilities tab and find Background Modes. If Background Modes is not found, clickthe '+ Capability' button to search and add Background Modes.
Select Location updates and Remote notifications.
Disable Bitcode for your application as Zendrive SDK does not support Bitcode.
On the Project Settings screen select your application's target.
Click Build Settings.
Search for Enable Bitcode.
Ensure it is set to No.
Add Location and Motion usage description entries in Info.plist file.
<key>NSLocationAlwaysUsageDescription</key>
<string>Your precise location helps us to better determine your driving behavior even if you don't have the app open.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your precise location helps us to better determine your driving behavior even if you don't have the app open.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your precise location helps us to better determine your driving behavior even if you don't have the app open.</string>
<key>NSMotionUsageDescription</key>
<string>Your activity information helps us to detect drives faster and more accurately.</string>
Additional steps for Google Maps on Android:
ZendriveIQLUIKit library uses google maps to render trips. Add the google maps api key in AndroidManifest.xml as follows.
Additionally, google-services.json file needs to be added to the application folder of your application.
Initialize UI Kit
To initialize ZendriveIQLUIKit correctly, follow a series of steps that include integrating multiple APIs, setting design system properties, and configuring ZendriveIQLUIKit based on the user's login state.
To initialize the ZendriveIQLUIKit SDK, you can simply use the initialize() method provided by ZendriveIQLUIkit. Additionally, the initialize method can accept optional parameters such as theme, typography, and viewFactory (For React Native, viewFactory is not provided). If no custom parameters are passed, the initialize method uses the default design system settings.
We recommend calling the initialize method as soon as the app launches. This approach enables the host app to leverage various components even before the user logs in.
Refer below for code snippets.
iOS
In your AppDelegate, ensure that ZendriveIQLUIKit is initialized when your application launches.
class AppDelegate: UIResponder, UIApplicationDelegate {
// ... Other methods and properties
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ... Other code
ZendriveIQLUIKit.initialize()
// ... Other code
return true
}
// ... Other methods and properties
}
Optionally, you can also specify custom theme, typography and viewfactory in the initialize call.
ZendriveIQLUIKit should be initialised before any component from UIKit is rendered. We recommend that the initialize call is added to the index.js of react native application.
import ZendriveIQLUIKit from 'react-native-zendrive-iqluikit';
ZendriveIQLUIKit.initialize();
AppRegistry.registerComponent(appName, () => App);
Optionally, you can also specify custom theme and typography in the initialize call.
The onUserLoggedIn API on Android requires an additional notificationProviderClass parameter, which specifies the class that will handle displaying notifications to the user.
Your OS may occasionally kill background services. To track trips properly, Zendrive uses a foreground service when a trip is in progress. To do this, the SDK asks the app for a required notification.
Define a IQLNotificationProvider class that implements the ZendriveIQLUIKitNotificationProvider interface.
Each of the following notification methods must be implemented according to your needs:
getWaitingForDriveNotificationContainer:This method is only called on Huawei devices and improves trip detection. Without this method, trips might not be detected on Huawei devices. Return null if you don't want to use this notification.
getMaybeInDriveNotificationContainer: This method is only called on devices with Android Oreo and above, and is called when the SDK detects a possible drive.
getInDriveNotificationContainer:This method is called when a drive has been detected.
The Notification Container contains the ID and Notification that can be passed to startForeground().
Android (Kotlin)
class IQLNotificationProvider : ZendriveIQLUIKitNotificationProvider {
companion object {
const val CHANNEL_KEY = "Zendrive"
const val MAYBE_IN_DRIVE_TITLE = "May be in drive"
const val MAYBE_IN_DRIVE_CONTENT_TEXT = "Detecting your drive"
const val IN_DRIVE_TITLE = "In drive"
const val IN_DRIVE_CONTENT_TEXT = "Driving"
const val MAYBE_IN_DRIVE_NOTIFICATION_ID = 1001
const val IN_DRIVE_NOTIFICATION_ID = 1002
}
override fun getWaitingForDriveNotificationContainer(context: Context): ZendriveNotificationContainer? {
return null
}
override fun getMaybeInDriveNotificationContainer(context: Context): ZendriveNotificationContainer {
createNotificationChannels(context)
return ZendriveNotificationContainer(
MAYBE_IN_DRIVE_NOTIFICATION_ID,
createMaybeInDriveNotification(context)
)
}
override fun getInDriveNotificationContainer(context: Context): ZendriveNotificationContainer {
createNotificationChannels(context)
return ZendriveNotificationContainer(
IN_DRIVE_NOTIFICATION_ID,
createInDriveNotification(context)
)
}
private fun createMaybeInDriveNotification(context: Context): Notification {
createNotificationChannels(context)
return NotificationCompat.Builder(context, CHANNEL_KEY)
.setContentTitle(MAYBE_IN_DRIVE_TITLE)
.setDefaults(0)
.setPriority(NotificationCompat.PRIORITY_MIN)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setContentText(MAYBE_IN_DRIVE_CONTENT_TEXT)
.build()
}
private fun createInDriveNotification(context: Context): Notification {
return NotificationCompat.Builder(context, CHANNEL_KEY)
.setContentTitle(IN_DRIVE_TITLE)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setContentText(IN_DRIVE_CONTENT_TEXT)
.build()
}
private fun createNotificationChannels(context: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val manager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val lowPriorityNotificationChannel = NotificationChannel(
CHANNEL_KEY,
CHANNEL_KEY,
NotificationManager.IMPORTANCE_MIN
)
lowPriorityNotificationChannel.setShowBadge(false)
manager.createNotificationChannel(lowPriorityNotificationChannel)
}
}
}
React Native
const notificationProviderData = {
channelKey: 'Zendrive',
maybeInDriveTitle: 'May be in drive',
maybeInDriveContentText: 'Detecting your drive',
inDriveTitle: 'In drive',
inDriveContentText: 'Driving',
maybeInDriveNotificationId: 1001,
inDriveNotificationId: 1002,
zendriveNotificationChannelId: 'zendrive_notification_channel',
}
const notificationProviderInstance = new ZendriveIQLUIKitNotificationProvider(notificationProviderData);
// the created notificationProviderInstance gets passed to the onUserLoggedIn() method
Integrate onUserLoggedIn API
You need to call the onUserLoggedIn API in two specific scenarios:
Please ensure that you provide the required information, including the driver's ID, Zendrive sdkKey and a callback that returns the Identification Token.
getIdentificationTokenCallback will be invoked by ZendriveIQLUIKit to get the Identification Token. You must implement this method to create a unique Identification Token per user. For more details on generating this token, see Authenticate UIKit to call IQL Backend APIs.
You must ensure that this method is called before any component in ZendriveIQLUIKit is displayed to the user.
After User Login
After a user successfully logs in to your application, it's crucial to notify ZendriveIQLUIKit about their login status. You can accomplish this by invoking the onUserLoggedIn() method.
iOS
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */
)
Android
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */
notificationProviderClass = /* Your class that implements NotificationProvider eg: IQLNotificationProvider::class.java */
)
React Native
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */,
notificationProvider: /* Optional ZendriveIQLUIKitNotificationProvider instance */
)
On App Launch
Every time your app is launched, it's essential to verify the user's login status. If the user is logged in, call the onUserLoggedIn method of ZendriveIQLUIKit.
iOS
In the AppDelegate's didFinishLaunchingWithOptions method, verify whether the user is logged in. If the user is logged in, call the onUserLoggedIn method of ZendriveIQLUIKit.
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize ZendriveIQLUIKit when the app launches.
ZendriveIQLUIKit().initialize()
// Check if the user is logged in.
if isUserLoggedIn() {
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */
)
} else {
//.. handle not logged in state
}
return true
}
}
Android
class MainApplication : Application() {
override fun onCreate() {
ZendriveIQLUIKit.initialize(applicationContext)
if(isUserLoggedIn()) {
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */,
notificationProviderClass = /* Your class that implements NotificationProvider eg: IQLNotificationProvider::class.java */
)
} else {
//.. handle not logged in state
}
}
}
React Native
We recommend that this method is called in the useEffect hook, before any component from ZendriveIQLUIKit is rendered in the view hierarchy.
const Home: React.FC = (props: Props) => {
// Hook that gets executed when the login status of the user changes
React.useEffect(() => {
if (isUserLoggedIn) {
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */,
notificationProviderClass = /* Optional ZendriveIQLUIKitNotificationProvider instance*/
)
} else {
//.. handle not logged in state
}
}, [isUserLoggedIn]);
return (
// Optional: Component UI
)
}
Provide Data To Fill in UIKit Screens
Some of the UI screens in UIKit require additional data for the ideal user experience. You can provide this data to ensure that UIKit is able to drive the right experience.
This data is cached in UIKit locally and it does not go out unless the user agree to share it to access offers.
Get user’s info using getPersonalInfo API
To get the user’s personal information, use the getPersonalInfo API. It is recommended to call getPersonalInfo before invoking the setPersonalInfo API to avoid overwriting of existing values.
Set user's info using setPersonalInfo API
The user's personal info is presented in the offer details page and it is shared with the advertiser whenever the user taps on the CTA to access the offer.
To set the user's personal information, use the setPersonalInfo API.
It is recommended to call setPersonalInfo immediately after the user logs in or during the app’s launch if the user is already logged in. This is done in a manner similar to calling the onUserLoggedIn API.
Prior to calling the setPersonalInfo API, it is required to verify if a nil value is returned by the getPersonalInfo API. Skipping this check may lead to repeated calls on every relaunch and overwritten user-updated information.
iOS
//...
ZendriveIQLUIKit.onUserLoggedIn(..)
//...
// Set the user's personal information
let address = PersonalInfo.Address(street: /*Street*/,
city: /*city*/,
stateCode: /*stateCode*/,
zipcode: /*zipcode*/)
let dateOfBirthString = /*Date in "yyyy-MM-dd" format*/
let personlInfo = PersonalInfo(
firstName: /*User's firstName*/,
lastName: /*User's lastName*/,
emailAddress: /*User's emailAddress*/,
dateOfBirthString: dateOfBirthString,
address: address)
ZendriveIQLUIKit.getPersonalInfo(onComplete: {data in
if data == nil {
ZendriveIQLUIKit.setPersonalInfo(personlInfo)
}
})
Android
//...
ZendriveIQLUIKit.onUserLoggedIn(..)
//...
// Set the user's personal information
val address = Address(street, city, stateCode, zipCode)
val dateOfBirthString = /*Date in "yyyy-MM-dd" format*/
val personalInfo = PersonalInfo(
firstName = /*User's firstName*/,
lastName = /*User's lastName */,
email = /*User's emailAddress*/,
dateOfBirth = dateOfBirthString,
address = address
)
ZendriveIQLUIKit.getPersonalInfo { data ->
if (data == null) {
ZendriveIQLUIKit.setPersonalInfo(personalInfo)
}
}
React Native
//...
ZendriveIQLUIKit.onUserLoggedIn(..)
//...
// Set the user's personal information
let address = ZendriveIQLUIKit.Address(street, city, stateCode, zipCode);
let dateOfBirthString = /*Date in "yyyy-MM-dd" format*/;
let personlInfo = ZendriveIQLUIKit.PersonalInfo(
firstName: /*User's firstName*/,
lastName: /*User's lastName*/,
emailAddress: /*User's emailAddress*/,
dateOfBirthString: dateOfBirthString, /* Optional */
address: address /* Optional */
insurer: /* Insurer name - Optional*/);
ZendriveIQLUIKit.getPersonalInfo(onComplete: {data in
if (data == null) {
ZendriveIQLUIKit.setPersonalInfo(personlInfo)
}
})
Integrate setLegalData API
For transparency and legal compliance, it is a good practice to present application's terms and privacy agreement to the users whenever the users try to opt into the program. These links are presented in the following page in UIKit, if available:
Use the setLegalData API to set the terms and conditions link and privacy policy links.
It is recommended to call setLegalData immediately after the user logs in or during the app's launch if the user is already logged in. This is done in a manner similar to calling the onUserLoggedIn API.
You need to call the onUserLoggedOut API when the user successfully logs out. This ensures that UIKit stops tracking user trips.
Additionally, if you want the users to go through the onboarding and permissions flow again post login, then you can pass the optOut parameter as true.
Please note that the users will always go through the onboarding and permissions flow again in case they uninstall and install the app again.
iOS
ZendriveIQLUIKit.onUserLoggedOut()
// or if you want the users to go through the onboarding
// and permissions flow again post login,
// then you can pass the optOut parameter as true.
ZendriveIQLUIKit.onUserLoggedOut(optOut: true)
Android
ZendriveIQLUIKit.onUserLoggedOut()
// or if you want the users to go through the onboarding
// and permissions flow again post login,
// then you can pass the optOut parameter as true.
ZendriveIQLUIKit.onUserLoggedOut(optOut = true)
React Native
ZendriveIQLUIKit.onUserLoggedOut()
// or if you want the users to go through the onboarding
// and permissions flow again post login,
// then you can pass the optOut parameter as true.
ZendriveIQLUIKit.onUserLoggedOut(optOut: true)
Integrate enableLogging API (Optional)
Logging is enabled by default in ZendriveIQLUiKit, this helps in debugging crashes or detecting any issues encountered for a user.
iOS (Swift)
ZendriveIQLUIKit.enableLogging(true) // enabled by default
Android (Kotlin)
ZendriveIQLUIKit.enableLogging(true) // enabled by default
React Native
ZendriveIQLUIKit.enableLogging(true) // enabled by default
Integrate setIntegrationMode API (Optional)
For debugging integration issues, you can enable Integration Mode using the following method.
if (__DEV__)
ZendriveIQLUIKit.setIntegrationMode(true);
Modularize the integration code using ZendriveIQLUIKitManager
To maintain the ZendriveIQLUIKit code in a centralized location, it is recommended to create a separate class, typically named ZendriveIQLUIKitManager and consolidate all ZendriveIQLUIKit-related code within this class. You can then call this manager class from various parts of your application to ensure a more organized and modular structure.
iOS (Swift)
import ZendriveIQLUIKit
class ZendriveIQLUIKitManager: NSObject {
func initialize() {
// Initialize ZendriveIQLUIKit
ZendriveIQLUIKit.initialize()
}
func onUserLoggedIn() {
// Check if the driver ID is available (replace "your_driver_id" with the actual driver ID)
if let driverId = "your_driver_id" {
// Call onUserLoggedIn to inform ZendriveIQLUIKit
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */
)
// Set the user's personal information
let address = ZendriveIQLUIKit.Address(street, city, stateCode, zipCode);
let dateOfBirthString = /*Date in "yyyy-MM-dd" format*/;
let personlInfo = ZendriveIQLUIKit.PersonalInfo(
firstName: /*User's firstName*/,
lastName: /*User's lastName*/,
emailAddress: /*User's emailAddress*/,
dateOfBirthString: dateOfBirthString,
address: address);
ZendriveIQLUIKit.setPersonalInfo(personlInfo);
// Set the terms and conditions and privacy policy links
ZendriveIQLUIKit.setLegalData(
tncLink: /* https://www.example.com/terms-of-use */,
privacyLink: /* https://www.example.com/privacy-policy */
)
}
}
func onUserLoggedOut(completion: (() -> Void)?) {
// Call onUserLoggedOut to log the user out
ZendriveIQLUIKit.onUserLoggedOut()
}
}
Recommended Initialization Points for ZendriveIQLUIKit
For optimal functionality, we suggest initializing ZendriveIQLUIKit in two specific locations:
On AppDelegate's didFinishLaunchingWithOptions: Ensure that ZendriveIQLUIKit is set up and initialized every time your app is launched. However, only proceed with this onUserLoggedIn if the user is already logged in.
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize ZendriveIQLUIKit when the app launches.
ZendriveIQLUIKitManager().initialize()
if isUserLoggedIn() {
// Call onUserLoggedIn when the user is logged in
ZendriveIQLUIKitManager().onUserLoggedIn()
} else {
// Call onUserLoggedOut when the user is not logged in
ZendriveIQLUIKitManager().onUserLoggedOut()
}
return true
}
}
Post Successful Login: It's crucial to initialize ZendriveIQLUIKit right after a user logs in. This way, you can be confident that the user-specific configurations or details are set up accurately.
fun loginSuccessful() {
ZendriveIQLUIKitManager().onUserLoggedIn()
}
Post Successful Logout: On successful logout, call the onUserLoggedOut to ensure that the required tearDown calls are made in the ZendriveIQLUIKit.
fun logoutSuccessful() {
ZendriveIQLUIKitManager().onUserLoggedOut()
}
Android (Kotlin)
To maintain the ZendriveIQLUIKit code in a centralized location, it is recommended to create a separate class, typically named ZendriveIQLUIKitManager and consolidate all ZendriveIQLUIKit-related code within this class. You can then call this manager class from various parts of your application to ensure a more organized and modular structure.
object ZendriveIQLUIKitManager {
private val scope = CoroutineScope(Dispatchers.Default)
fun initialize(applicationContext: Context) {
ZendriveIQLUIKit.initialize(applicationContext)
}
fun onUserLoggedIn() {
ZendriveIQLUIKit.onUserLoggedIn(
driverId: /* Your driver id. */,
sdkKey: /* Your Zendrive sdkKey */,
getIdentificationTokenCallback: /* Your getIdentificationTokenCallback */
notificationProviderClass = /* Your class that implements NotificationProvider eg: IQLNotificationProvider::class.java */
)
val address = Address(street, city, stateCode, zipCode)
val dateOfBirthString = /*Date in "yyyy-MM-dd" format*/
val personalInfo = PersonalInfo(
firstName = /*User's firstName*/,
lastName = /*User's lastName */,
email = /*User's emailAddress*/,
dateOfBirth = dateOfBirthString,
address = address
)
ZendriveIQLUIKit.setPersonalInfo(personalInfo)
ZendriveIQLUIKit.setLegalData(
tncLink: /* https://www.example.com/terms-of-use */,
privacyLink: /* https://www.example.com/privacy-policy */
)
}
fun onUserLoggedOut() {
ZendriveIQLUIKit.onUserLoggedOut()
}
}
Recommended Initialization Points for ZendriveIQLUIKit
For optimal functionality, we suggest initializing ZendriveIQLUIKit in two specific locations:
Application class onCreate: Ensure that ZendriveIQLUIKit is set up and initialized every time your app is launched. However, only proceed with this initialization if the user is already logged in.
override fun onCreate() {
super.onCreate()
ZendriveIQLUIKit.initialize(applicationContext)
if (isUserLoggedIn()) {
ZendriveIQLUIKitManager().onUserLoggedIn()
} else {
ZendriveIQLUIKitManager().onUserLoggedOut()
}
}
Post Successful Login: It's crucial to initialize ZendriveIQLUIKit right after a user logs in. This way, you can be confident that the user-specific configurations or details are set up accurately.
fun loginSuccessful() {
ZendriveIQLUIKitManager().onUserLoggedIn()
}
Post Successful Logout: On successful logout, call the onUserLoggedOut to ensure that the required tearDown calls are made in the ZendriveIQLUIKit.
fun logoutSuccessful() {
ZendriveIQLUIKitManager().onUserLoggedOut()
}
Identifying Integration Errors
To get notified about integration errors you can observe the uikitErrorObservable.
iOS (Swift)
ZendriveIQLUIKit.uikitErrorObservable({error in
switch error {
case .accountDeactivated:
// call ZendriveIQLUIKitManager.onUserLoggedOut(true)
// remove any UIKit views displayed to user
break
case .identificationTokenExpired:
// generate new Identification Token
// use ZendriveIQLUIKit.setIdentificationToken(token)
// to set new token
break
case .identityKeyDeactivated:
// contact customer support for Identity Key Deactivation
break
case .invalidIdentificationToken:
// set the valid Identification Token
// use ZendriveIQLUIKit.setIdentificationToken(token)
// to set new token
break
default:
break
}
})
Android (Kotlin)
ZendriveIQLUIKit.uikitErrorObservable.collectLatest {
when(it) {
UiKitError.AccountDeactivated -> {
// call ZendriveIQLUIKitManager.onUserLoggedOut(true)
// remove any UIKit views displayed to user
}
UiKitError.IdentificationTokenExpired -> {
// generate new Identification Token
// use ZendriveIQLUIKit.setIdentificationToken(token)
// to set new token
}
UiKitError.IdentityKeyDeactivated -> {
// contact customer support for Identity Key Deactivation
}
UiKitError.InvalidIdentificationToken -> {
// set the valid Identification Token
// use ZendriveIQLUIKit.setIdentificationToken(token)
// to set new token
}
else -> {
// log for more errors
}
}
}