Skip to content

.NET Android

To change the existing localization, you can use the SetLocalizationCallback function provided by the Face SDK. This will remap any string found in the native API.

Here is an example of how you can override any existing localization provided by the Face SDK:

using Com.Regula.Facesdk.Callback;
using Com.Regula.Facesdk.Exception;
using Com.Regula.Facesdk;
using Com.Regula.Common;

namespace FaceSample.Platforms.Android
{
    public class FaceSdkInit : Java.Lang.Object, IFaceSdkInit, IInitCallback, ILocalizationCallbacks
    {
        public FaceSdkInit()
        {
        }

        public void InitFaceSdk()
        {
            FaceSDK.Instance().Init(Platform.AppContext, this);
        }

        public void OnInitCompleted(bool success, InitException error)
        {
            FaceSDK.Instance().SetLocalizationCallback(this);
        }

        string ILocalizationCallbacks.OnLocalize(string key)
        {
            if (key == "livenessGuide.head")
                return "My first custom string";
            if (key == "livenessGuide.button")
                return "My second custom string";
            return null;
        }
    }
}