# Configuring Terminal Kiosk Mode

This guide explains how to use `PeripheralsLib` to configure "Kiosk Mode" settings on the terminal. This allows you to restrict user navigation and set a default launcher application.

<Callout type="warning">

These configurations can block normal device usage (e.g., hiding navigation bars). Always ensure you have a mechanism within your app to disable these restrictions or an alternative method to exit the application during development.

</Callout>

## Configuration Object: MSG8210

Configuration is managed via the `MSG8210` object. You must set the properties of this object before passing it to the manager.

### Properties

| Property | Type | Description | Mandatory? |
| :---- | :---- | :---- | :---- |
| `launcherAppPackage` | String | Package ID of the app to set as the default launcher. | No (can be null) |
| `launcherAppActivity` | String | Main Activity class name (Format: `Package.Activity`). | No (can be null) |
| `enableStatusBar` | Boolean | If `false`, the status bar (top) cannot be expanded. | **Yes** |
| `enableNavigationBar` | Boolean | If `false`, navigation buttons (bottom) are disabled. | **Yes** |
| `showStatusBar` | Boolean | If `false`, the status bar is hidden from the screen. | **Yes** |
| `showNavigationBar` | Boolean | If `false`, the navigation bar is hidden from the screen. | **Yes** |

## Applying Configuration

Use the `configTerminal` method to apply the settings defined in the `MSG8210` object.

```
// 1. Create and configure the settings object
MSG8210 config = new MSG8210();

// Set the default launcher (Optional)
config.launcherAppPackage = "com.mycompany.posapp";
config.launcherAppActivity = "com.mycompany.posapp.MainActivity";

// Configure UI restrictions (Mandatory)
config.enableStatusBar = false;   // Prevent pulling down notifications
config.enableNavigationBar = false; // Disable back/home/recent buttons
config.showStatusBar = false;     // Hide top bar
config.showNavigationBar = false; // Hide bottom bar

// 2. Apply configuration
manager.configTerminal(config, new ConfigCallback() {
    @Override
    public void onSuccess() {
        Log.d("KioskMode", "Terminal configured successfully.");
    }

    @Override
    public void onError(int errorCode) {
        Log.e("KioskMode", "Configuration failed. Code: " + errorCode);
    }
});
```

## Troubleshooting Configuration Errors

If the configuration fails, the `onError` callback will return one of the following codes:

| Code | Meaning | Action |
| :---- | :---- | :---- |
| **-1** | Configuration Error | Check if your `MSG8210` parameters are valid. |
| **-2** | Not Supported | The terminal model or OS version does not support these settings. |
| **-3** | Communication Error | Retry the operation. |
| **-99** | Indeterminate | Unknown error. Check system logs. |