> For the complete documentation index, see [llms.txt](https://docs.iadvize.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iadvize.dev/~/changes/39J6v2tWi3Ms7Me1qEFP/technologies/web-and-mobile-sdk/mobile-sdk/frequently-asked-questions.md).

# Frequently Asked Questions

## 🔆 Forcing Light/Dark UI

By default the iAdvize Messenger SDK displays its UI following the user settings choice on light/dark mode. It is however possible to force the light/dark mode to a given value.

{% tabs %}
{% tab title="Android" %}
Using [setDefaultNightMode](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#setDefaultNightMode\(int\)) inside the `Application` object will force the app, and thus the SDK Chatbox, to be displayed in the chosen mode:

```kotlin
class App : Application() {
  override fun onCreate() {
    super.onCreate()
    AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO)
  }
}
```

{% endtab %}

{% tab title="iOS" %}
Using [overrideUserInterfaceStyle](https://developer.apple.com/documentation/uikit/uiview/3238086-overrideuserinterfacestyle) on the highest hierarchy view (Window) will force the app, and thus the SDK Chatbox, to be displayed in the chosen mode:

```swift
override func viewDidAppear(_ animated: Bool) {
  super.viewDidAppear(animated)
  view.window?.overrideUserInterfaceStyle = .light
}
```

{% endtab %}
{% endtabs %}

## 📣 Updating user language

The iAdvize Messenger SDK has a navigation process that is language dependent. That means that when the targeting language is updated inside the client application (for instance in apps offering multiple languages support) the user navigation must be updated in order for the engagement process to be functional again. This can be easily done by calling `registerUserNavigation` right after updating the targeting language:

{% tabs %}
{% tab title="Android" %}

```kotlin
IAdvizeSDK.targetingController.language = LanguageOption.Custom(Language.fr)
IAdvizeSDK.targetingController.registerUserNavigation(NavigationOption.KeepActiveRule)
```

{% endtab %}

{% tab title="iOS" %}

```swift
IAdvizeSDK.shared.targetingController.language = .custom(value: .fr)
IAdvizeSDK.shared.targetingController.registerUserNavigation(navigationOption: .keepActiveRule)
```

{% endtab %}

{% tab title="React Native" %}

```javascript
IAdvizeSDK.setLanguage('fr');
IAdvizeSDK.registerUserNavigation(NavigationOption.keep, "", "");
```

{% endtab %}

{% tab title="Flutter" %}

```dart
IAdvizeSdk.setLanguage('fr');
IAdvizeSdk.registerUserNavigation(navigationOption: NavigationOption.optionKeep);
```

{% endtab %}
{% endtabs %}

## 🤷 Missed opportunities

The iAdvize Mobile SDK inherits from some behavior of the Web Platform in order to benefit from all the Web Platform features like Monitoring & Statistics.

The **Missed Opportunities** behavior is one of them. When the website triggers a targeting rule for a visitor, for the first time, but there is no agent available to answer, the engagement process is terminated as a **Missed opportunity**, and the visitor cannot be engaged on the same page again, even when re-triggering the targeting rule when there are agents available to answer.

The Mobile SDK uses the same approach, but as mobile users have a different navigation process a `registerUserNavigation` method was added to fix those kinds of navigation discrepancies.

Indeed this method acts in a similar way to `activateTargetingRule` but it adds upon it the update of the user navigation, thus allowing a new engagement.

More information on the use of this method can be found on the [dedicated section](/~/changes/39J6v2tWi3Ms7Me1qEFP/technologies/web-and-mobile-sdk/mobile-sdk/angelot.md#4-following-user-navigation).

## 🚦 Testing the SDK on Android <a href="#testing-the-sdk-android" id="testing-the-sdk-android"></a>

If you are running unit tests that implies the SDK, some additional steps may be needed.

The Android SDK uses two device system constants that are not instantiated inside the unit test flow, you will have to register them inside your unit tests initiation:

```
ReflectionHelpers.setStaticField(android.os.Build::class.java, "MODEL", "whatever")
ReflectionHelpers.setStaticField(android.os.Build::class.java, "MANUFACTURER", "whatever")
```

{% hint style="warning" %}
*Please also be sure to initialize the SDK during the unit tests setup (see the* [*Setting up the SDK*](/~/changes/39J6v2tWi3Ms7Me1qEFP/technologies/web-and-mobile-sdk/mobile-sdk/angelot.md#1-setting-up-the-sdk-into-your-project-configuration) *section).*
{% endhint %}
