• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# HalfScreenLaunchComponent
2
3**HalfScreenLaunchComponent** is a component designed for launching atomic services in half screen. If the invoked application (the one being launched) grants the invoker the authorization to run the atomic service in an embedded manner, the invoker can operate the atomic service in half-screen embedded mode. If authorization is not provided, the invoker will launch the atomic service in a pop-up manner.
4
5> **NOTE**
6>
7> This component is supported since API version 18. Updates will be marked with a superscript to indicate their earliest API version.
8>
9> To implement an embeddable atomic service, make sure it inherits from [EmbeddableUIAbility](../../apis-ability-kit/js-apis-app-ability-embeddableUIAbility.md). This ensures that it functions properly.
10
11## Modules to Import
12
13```
14import { HalfScreenLaunchComponent } from '@kit.ArkUI';
15```
16
17## Child Components
18
19Not supported
20
21## Attributes
22The [universal attributes](ts-component-general-attributes.md) are not supported.
23
24## HalfScreenLaunchComponent
25
26HalfScreenLaunchComponent({
27&emsp;content: Callback\<void>,
28&emsp;appId: string,
29&emsp;options?: AtomicServiceOptions,
30&emsp;onError?: ErrorCallback,
31&emsp;onTerminated?: Callback&lt;TerminationInfo&gt;
32  })
33
34**Decorator**: \@Component
35
36**Atomic service API**: This API can be used in atomic services since API version 18.
37
38**System capability**: SystemCapability.ArkUI.ArkUI.Full
39
40**Parameters**
41
42| Name| Type| Mandatory| Decorator| Description|
43| -------- | -------- | -------- | -------- | -------- |
44| content | Callback\<void> | Yes| \@BuilderParam | Content displayed in the component.|
45| appId | string | Yes| - | Application ID for the atomic service.|
46| options | [AtomicServiceOptions](../../apis-ability-kit/js-apis-app-ability-atomicServiceOptions.md) | No| - | Parameters for starting the atomic service. The default value is empty.|
47| onError |[ErrorCallback](../../apis-basic-services-kit/js-apis-base.md#errorcallback) | No| - | Invoked when an error occurs during the running of the atomic service.|
48| onTerminated | [Callback](../../apis-basic-services-kit/js-apis-base.md#callback)\<TerminationInfo> | No| - |  Callback used to return the result of the atomic service. The input parameter is of type **TerminationInfo**.|
49
50## Example
51
52This example demonstrates how to start a top-up service in embedded mode.
53
54```ts
55import { HalfScreenLaunchComponent } from '@kit.ArkUI';
56
57@Entry
58@Component
59struct Index {
60  appId: string = "5765880207853275489"; // Application ID of the top-up service
61
62  build() {
63    Column() {
64      HalfScreenLaunchComponent({
65        appId: this.appId,
66        options: {},
67        onTerminated:  (info:TerminationInfo)=> {
68          console.log('onTerminated info = '+ info.want);
69        },
70        onError: (err) => {
71          console.error(" onError code: " + err.code + ", message: ", err.message);
72        }
73      }) {
74        Column() {
75          Image($r('app.media.app_icon'))
76          Text('Start top-up')
77        }.width("80vp").height("80vp").margin({bottom:30})
78      } // Content is passed as a trailing closure.
79    }
80  }
81
82}
83```
84