• 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 } 16300501 - the system ability work abnormally.
39     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
40     * @since 18
41     */
42    function on(type: 'prepareContinue', context: Context, callback: AsyncCallback<ContinueResultInfo>): void;
43
44    /**
45     * Unregister prepareContinue event.
46     *
47     * @param { 'prepareContinue' } type - Registration Type, 'prepareContinue'.
48     * @param { Context } context - the ability context.
49     * @param { AsyncCallback<ContinueResultInfo> } callback - Used to handle ('prepareContinue') command.
50     * @throws { BusinessError } 16300501 - the system ability work abnormally.
51     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
52     * @since 18
53     */
54    function off(type: 'prepareContinue', context: Context, callback?: AsyncCallback<ContinueResultInfo>): void;
55
56    /**
57     * Continue result info.
58     * @interface ContinueEventInfo
59     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
60     * @since 18
61     */
62    interface ContinueResultInfo {
63        /**
64         * Continue state code.
65         * @type { ContinueStateCode }
66         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
67         * @since 18
68         */
69        resultState: ContinueStateCode;
70
71        /**
72         * Result info.
73         * @type { ?string }
74         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
75         * @since 18
76         */
77        resultInfo?: string;
78    }
79
80    /**
81     * Continue state code.
82     * @enum { number }
83     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
84     * @since 18
85     */
86    enum ContinueStateCode {
87        /**
88         * Continue success
89         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
90         * @since 18
91         */
92        SUCCESS = 0,
93
94        /**
95         * System error
96         * @syscap SystemCapability.Ability.AbilityRuntime.Mission
97         * @since 18
98         */
99        SYSTEM_ERROR,
100    }
101}
102export default continueManager;