Native Android

🌍 Native Android Internationalization for REL-ID IDV SDK

This guide provides steps to programmatically change the SDK language in a Native Android app using the REL-ID IDV SDK, based on Section 11.5.2 of the integration guide.


🧾 Overview

Internationalization allows users to select their preferred language within the app. To reflect this change in all REL-ID SDK components, you must store the selected locale in the app’s shared preferences so that the SDK can adapt accordingly.


🔧 Implementation

Use the following code snippets to store the locale when the user changes the app language.


📱 Java

public void setLocale(Context context, String locale){
    // Example locale: "es" for Spanish, "fr" for French
    SharedPreferences sharedpreferences = context.getSharedPreferences("customAppConfig", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedpreferences.edit();
    editor.putString("appLanguage", locale);
    editor.commit();
}

📱 Kotlin

fun setLocale(context: Context, locale: String) {
    // Example locale: "es" for Spanish, "fr" for French
    val sharedpreferences = context.getSharedPreferences("customAppConfig", Context.MODE_PRIVATE)
    val editor = sharedpreferences.edit()
    editor.putString("appLanguage", locale)
    editor.commit()
}

🧠 Notes

  • The locale string should be in the ISO 639-1 format (e.g., "en", "hi", "de").
  • The key "appLanguage" is used by the SDK to read the preferred language.
  • This setting should be updated as soon as the user switches language preferences in the app.

By saving the selected locale this way, the REL-ID SDK will dynamically adapt its UI and messages to the user’s language preference, enabling full internationalization support.