Xamarin Onboarding Incode

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

C#

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:

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:

Adapt Info.plist by adding:

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

C#

// 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:

C#

// 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.

C#

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

Known issues

Selfie camera not opening if flow is started multiple times