PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV Mobile 25 feature!
  • Overview
  • Android and kiosk mode
  • Overview
  • Simple kiosk mode
  • Full kiosk mode
  • How to manage simple kiosk mode in a WINDEV Mobile application?
  • How to?
  • Remarks
  • How to manage full kiosk mode in a WINDEV Mobile application?
  • How to?
  • Command line to enable full kiosk mode
  • How to test an application using full kiosk mode?
  • Remarks on full kiosk mode
  • Tips and programming
  • Tips
  • WLanguage functions related to the use of kiosk mode
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
A kiosk application is an application from which the user cannot exit. When an application is in kiosk mode, the user cannot launch other applications, has no access to the device settings, sees and receives neither notifications nor calls.
There are many use cases: demonstration application, digital kiosk application, application for children, purpose-built application, etc.
Android and kiosk mode

Overview

Since Android 5.0, there are two options to create an application in kiosk mode:
  • 'simple' kiosk mode ("Screen Pinning" feature).
  • 'full' kiosk mode.

Simple kiosk mode

This feature allows, without special permissions, to display only one application on the screen:
  • the status bar is emptied,
  • notification icons are hidden,
  • the "Home" and "Recent" buttons are disabled,
  • other applications cannot start new activities.
This feature can be used, for example, to lend your phone to children or other people without the risk of personal data leaks..
However, this feature is insufficient in most other cases. Indeed:
  • a user confirmation is requested before switching to this mode.
  • the user can exit this mode at any time by simultaneously pressing the "Back" and "Recent" buttons.

Full kiosk mode

Unlike simple kiosk mode:
  • full kiosk mode does not require confirmation.
  • the user cannot leave full kiosk mode.
However, implementing this kiosk mode requires specific privileges. These privileges can be obtained only:
  • when the application is device owner
  • if a device owner application gives these privileges to the application.
A device owner application can perform operations usually reserved for system applications (provided they are declared): create users, modify global settings (access to wifi, Bluetooth), define security policies, hide applications, and in particular in the case of kiosk mode: lock the application to prevent the user from leaving it.
How to manage simple kiosk mode in a WINDEV Mobile application?

How to?

To manage the simple kiosk mode:
  1. Use KioskEnable.
  2. A confirmation message is displayed to the user to enable or disable the kiosk mode.

Remarks

  • InKioskMode is used to find out whether the kiosk mode is enabled.
  • It is possible to exit kiosk mode using KioskDisable.
How to manage full kiosk mode in a WINDEV Mobile application?

How to?

To manage the full kiosk mode:
  1. Switch the application to "Device owner" mode:
    • Check "Device management application (can become "device owner" for the kiosk mode)" in the Android project configuration description.
    • Run the command line to enable full kiosk mode (see below).
  2. Use KioskEnable in the application to enable kiosk mode.

Command line to enable full kiosk mode

After installing the application on the Android device, run the following ADB command for the device on which the application is installed:
adb shell dpm set-device-owner
<package>/fr.pcsoft.wdjava.core.application.WDDeviceAdminReceiver
where:
<Package> corresponds to the package name of your Android application.
This command creates an entry in the "/data/system/ device_owner.xml" file which references the application as "device owner".
Remark: There can only be one device owner application per device and this operation is only possible if no user has been configured on the device. Otherwise, it is necessary to delete all users before running the command.

How to test an application using full kiosk mode?

To test an Android application using full kiosk mode, it is recommended to perform a test in the emulator. It is then possible to reset the emulator to test other applications.
From from Android 7.0, it is possible to indicate that the application is only used for test purposes when generating the Android application.
WINDEV Mobile offers this option in the Android application generation wizard if:
  • "Device management application (can become "device owner" for the kiosk mode)" has been checked in the Android configuration description.
  • the application is not signed for the store during its generation.
This option consists in using "android:testOnly=true" in the application manifest.
In this case, after the tests performed on the mobile device, it is possible to disable the "Device owner" mode with the following command line:
adb shell dpm remove-active-admin <package>/fr.pcsoft.wdjava.core.application.WDDeviceAdminReceiver
It is recommended to enable this option during the application test phase. A test application cannot be deployed on Play Store.

Remarks on full kiosk mode

  • Once an application has been set as "device owner", it is no longer possible to disable this mode or even delete the application. Only a factory reset can delete the application.
  • To update an application in device owner mode, it is necessary to sign it with the same key used to enable the mode.
  • InDeviceOwnerMode is used to find out whether the application is device owner.
  • InKioskMode is used to find out whether the kiosk mode is enabled.
  • It is possible to exit kiosk mode with KioskDisable.
Tips and programming

Tips

  • It is recommended to prepare a way out of kiosk mode (menu option accessed by password, etc.).
  • In case of system restart (battery problem, etc.), the kiosk mode will not be kept the next time the application is launched. Consider the following options :
    • Automatically restart the application: check "Automatically start the application when starting the device" in the Android application generation wizard.
    • Save the application mode (kiosk mode or not) so that the next time the application is launched, this mode is configured by default (for example, use SaveParameter and LoadParameter in the "Initializing" event of the project).
    • If necessary, re-enable the kiosk mode (KioskEnable in the "Initializing" event of the project).

WLanguage functions related to the use of kiosk mode

Versions 25 and later
InDeviceOwnerMode
New in version 25
InDeviceOwnerMode
InDeviceOwnerMode
Indicates whether the Android application is in "Device owner" mode.
Versions 25 and later
InKioskMode
New in version 25
InKioskMode
InKioskMode
Indicates whether the Android application is in kiosk mode.
Versions 25 and later
KioskDisable
New in version 25
KioskDisable
KioskDisable
Disables kiosk mode for the current application.
Versions 25 and later
KioskEnable
New in version 25
KioskEnable
KioskEnable
Switches the current Android application to kiosk mode.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment