• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025-2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License"),
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22
23/**
24 * Providers methods for interacting with continue feature.
25 *
26 * @namespace continueManager
27 * @syscap SystemCapability.Ability.AbilityRuntime.Mission
28 * @since 18
29 */
30declare namespace continueManager {
31    /**
32     * Register prepareContinue event, when the ability is configured with 'ContinueQuickStart' in the continueType, then can get the
33     * result of LaunchReason.PREPARE_CONTINUATION.
34     *
35     * @param { 'prepareContinue' } type - Registration Type, 'prepareContinue'.
36     * @param { Context } context - the ability context.
37     * @param { AsyncCallback<ContinueResultInfo> } callback - Used to handle ('prepareContinue') command.
38     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.
39     * @throws { BusinessError } 16300501 - the system ability work abnormally.
40     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
41     * @since 18
42     */
43    function on(type: 'prepareContinue', context: Context, callback: AsyncCallback<ContinueResultInfo>): void;
44
45    /**
46     * Unregister prepareContinue event.
47     *
48     * @param { 'prepareContinue' } type - Registration Type, 'prepareContinue'.
49     * @param { Context } context - the ability context.
50     * @param { AsyncCallback<ContinueResultInfo> } callback - Used to handle ('prepareContinue') command.
51     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.
52     * @throws { BusinessError } 16300501 - the system ability work abnormally.
53     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
54     * @since 18
55     */
56    function off(type: 'prepareContinue', context: Context, callback?: AsyncCallback<ContinueResultInfo>): void;
57
58    /**
59     * Continue result info.
60     * @interface ContinueEventInfo
61     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
62     * @since 18
63     */
64    interface ContinueResultInfo {
65        /**
66         * Continue state code.
67         * @type { ContinueStateCode }
68         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
69         * @since 18
70         */
71        resultState: ContinueStateCode;
72
73        /**
74         * Result info.
75         * @type { ?string }
76         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
77         * @since 18
78         */
79        resultInfo?: string;
80    }
81
82    /**
83     * Continue state code.
84     * @enum { number }
85     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
86     * @since 18
87     */
88    enum ContinueStateCode {
89        /**
90         * Continue success
91         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
92         * @since 18
93         */
94        SUCCESS = 0,
95
96        /**
97         * System error
98         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
99         * @since 18
100         */
101        SYSTEM_ERROR,
102    }
103}
104export default continueManager;