Xamarin Onboarding Incode

NOTE: From version 1.4.6 Code Shrinker R8 can't be used for Android apps.

Installation

The wrapper is available via Nuget package located in the Nuget folder of the project. Make sure to add this folder to the list of sources for Nuget packages.

Package should be installed in all your projects.

For Visual Studio for Windows, run this command

Install-Package Com.Incode.Onboarding

Setup

Make sure you call the following line in your code in the OnCreate() method on the MainActivity for Android, and on iOS in the FinishedLaunching method inside the AppDelegate

var result = await IncodeOnboarding.Current.Init(YOUR_URL, YOUR_API_KEY);

Url and ApiKey will be provided to you by Incode.

Optionally, you can specify these params to the Init method:

  • isLoggingEnabled - Defaults to true.
  • isTestMode - Defaults to false. Specify true if you wish to run the app on the simulator, false if you wish to run it on device
  • disableHookCheck - Disables detection of installed hooked frameworks on an Android device.
  • disableRootDetection - Disables root detection on an Android device.
  • disableEmulatorDetection - Disables emulator detection on an Android device.

Hook, Root and Emulator detection is enabled by default in order to achieve maximum security against fraudsters. Please contact your representative at Incode if you wish to disable these in production.

InitResult will have these values:

  • Success - Initialization was successful
  • FailureSimulatorDetected - SDK is being run on the simulator
  • FailureRootDetected - SDK is being run on the rooted device
  • FailureHookDetected - SDK detected hooked frameworks on this device
  • FailureTestModeEnabled - SDK is being run on the device, but the isTestMode was set to true.

Adapt Info.plist by adding:

  • NSCameraUsageDescription. The SDK uses the camera in order to verify the identity of the customer, e.g. in ID scan, Selfie scan and so on.
  • NSLocationWhenInUseUsageDescription. The SDK uses the current user location in order to detect exact location for Geolocation step.
  • NSMicrophoneUsageDescription. The SDK uses microphone for performing a video call during Video Conference step or for doing speech recognition during Video Selfie.

Start Flow

SDK enables you to fully customize the experience of the flow, ie. by splitting Onboarding flow into multiple sections, adding your own custom screens between some of the steps etc.
For creating a new Onboarding with multiple sections you should call the API as the following

// Create a new Onboarding configuration
                var config = new OnboardingFlowConfiguration()
                                    .AllowUserToCancel(true) // optional, if you want users to be able to cancel the flow themselves
                                    .SetLocalizationLanguage("en_US") // optional, if you want to change the language at runtime. Possible values "en_US", es_ES" and "pt_PT"
                                    .AddIdScan(new IdScanParams(true, IdType.Id), result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddCurpValidation(result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddSelfieScan(new SelfieScanParams(true, true), result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddVideoSelfie(new VideoSelfieParams(), result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddDocumentScan(new DocumentScanParams(DocumentType.AddressStatement, true, false), result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddGeolocation(result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddFaceMatch(new FaceMatchParams(), result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddSignature(result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddApproval(result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    })
                                    .AddPhone(result =>
                                    {
                                        if (result != null && result.Result == ResultCode.Success)
                                        {
                                            // Module completed, process result
                                        }
                                    });

                // Create a new Onboarding session
                var session = await IncodeOnboarding.Current.CreateNewOnboardingSession(config);

                if (session != null)
                {
                    // Start the Onboarding section
                    var result = await IncodeOnboarding.Current.StartOnboardingSection(session.InterviewId, config);

                    if (result == ResultCode.Success)
                    {
                        // Section is completed, if we don't have new sections to start we should finish the onboarding session.
                        await IncodeOnboarding.Current.FinishOnboarding();
                    } else {
                        // Retry the section, show custom screen or start different section
                    }


                }

Once all the sections are completed successfully and no new modules will be used for this session, its needed to finalize the session as shown in the example below:

// Onboarding is now finalized
await IncodeOnboarding.Current.FinishOnboarding();

Face authentication can be started by calling VerifyFace with uuid value that you need to obtain by adding Approval module in flow configuration.

// Start face authentication
var result = await IncodeOnboarding.Current.VerifyFace(uuid);

Known issues

Selfie camera not opening if flow is started multiple times