• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.ability.kioskManager (Kiosk Mode Management) (System APIs)
2<!--Kit: Ability Kit-->
3<!--Subsystem: Ability-->
4<!--Owner: @zhu-feimo-->
5<!--Designer: @ccllee1-->
6<!--Tester: @lixueqing513-->
7<!--Adviser: @huipeizi-->
8
9The KioskManager module provides APIs to manage kiosk mode, including entering/exiting kiosk mode and querying the kiosk mode status.
10
11This module applies only to enterprise applications. In kiosk mode, an enterprise application can lock a device to a single application, ensuring that the UI serves only specific interactive scenarios, such as bank ATM terminals, KTV song-selection systems, and restaurant ordering systems.
12
13> **NOTE**
14>
15> The initial APIs of this module are supported since API version 20. Newly added APIs will be marked with a superscript to indicate their earliest API version.
16>
17> This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.app.ability.kioskManager (Kiosk Mode Management)](js-apis-app-ability-kioskManager.md).
18
19## Modules to Import
20
21```ts
22import { kioskManager } from '@kit.AbilityKit';
23```
24
25## kioskManager.getKioskStatus
26
27getKioskStatus(): Promise&lt;KioskStatus&gt;
28
29Obtains the Kiosk mode status information, including whether the system is in kiosk mode, and the name and UID of the application that has entered Kiosk mode. This API uses a promise to return the result.
30
31**System capability**: SystemCapability.Ability.AbilityRuntime.Core
32
33**System API**: This is a system API.
34
35**Return value**
36
37| Type| Description|
38|------|------|
39| Promise&lt;[KioskStatus](./js-apis-app-ability-kioskManager.md#kioskstatus20)&gt; | Promise used to return the kiosk mode status information.|
40
41**Error codes**
42
43For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Ability Error Codes](errorcode-ability.md).
44
45| ID| Error Message|
46|---------|---------|
47| 202 | Not system application. |
48| 801 | Capability not supported. |
49| 16000050 | Internal error. |
50
51**Example**
52
53```ts
54import { kioskManager } from '@kit.AbilityKit';
55import { hilog } from '@kit.PerformanceAnalysisKit';
56import { BusinessError } from '@kit.BasicServicesKit';
57
58@Entry
59@Component
60struct Index {
61  build() {
62    Column() {
63      Button('getKioskinfo').margin({ top: 10 })
64        .onClick(() => {
65          kioskManager.getKioskStatus()
66            .then((data: kioskManager.KioskStatus) => {
67              hilog.info(0x0000, 'testTag', '%{public}s', `getKioskinfo success: ${JSON.stringify(data)}`);
68            })
69            .catch((error: BusinessError) => {
70              hilog.error(0x0000, 'testTag', '%{public}s', `getKioskinfo failed:${JSON.stringify(error)}`);
71            });
72        })
73    }
74    .height('100%')
75    .width('100%')
76  }
77}
78```
79