- Kiosk mode
- Specific features
- Application in the background: Specific case from Android 10
In french: KiosqueActive
Switches the current Android application to kiosk mode. In this mode, users' actions are limited:
- users are prevented from leaving the application,
- users cannot run other applications,
- users cannot access the device settings,
- users do not see or receive notifications or calls.
Reminder: A kiosk application is an application from which the user cannot exit. When an application is in kiosk mode, user actions are limited. For more details, see Application in kiosk mode
// Switch the current application to kiosk mode
- The application must be in the foreground to be able to switch to kiosk mode.
- If the application uses simple kiosk mode (without Device owner), a confirmation message is displayed when the kiosk mode is enabled. The user can exit this mode by simultaneously pressing the "Back" and "Recent" buttons.
- If the application uses full kiosk mode (Device owner), the confirmation message is not displayed and the user cannot exit kiosk mode. To learn more about device owner applications, see Application in kiosk mode.
- InKioskMode allows you to find out whether the application is currently in kiosk mode.
- When kiosk mode is enabled:
- The "Home" and "Recent" buttons are disabled.
- Notifications are not displayed (even those sent by the application).
- It is not possible to launch another application (ShellExecute, AlbumPicker, StartShare, ... will fail).
- The system bar is empty. Time, battery information and other system details are not displayed.
- You can still change the volume or turn off the device.
- To exit kiosk mode, the application must call KioskDisable.
- KioskEnable has no effect in the simulator.
- If the device restarts, the kiosk mode will not be kept the next time the application is launched. You can:
- call KioskEnable in the "Initializing" event of the project.
- set the application to be launched at startup (in the Android application creation wizard) so that the application automatically returns to kiosk mode in case of restart.
- KioskEnable is only available on devices running Android 5.0 or later (API level 21).
A fatal error occurs if the function is used with an earlier system version.
To determine the version of Android the application is running on, use SysAndroidVersion.
Application in the background: Specific case from Android 10
From Android 10, it is no longer possible to open a window when the application is in the background.
KioskEnable can open a window. If this function is used while the application is in the background, a fatal error will occur.
- It is possible to determine if the application is in the background using InBackgroundMode.
- If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.