/* * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit AbilityKit */ import type { AsyncCallback } from '../@ohos.base'; import ExtensionContext from './ExtensionContext'; import type Want from '../@ohos.app.ability.Want'; import type StartOptions from '../@ohos.app.ability.StartOptions'; /*** if arkts 1.1 */ import type { AbilityResult } from '../ability/abilityResult'; import type { ConnectOptions } from '../ability/connectOptions'; import type AtomicServiceOptions from '../@ohos.app.ability.AtomicServiceOptions'; import OpenLinkOptions from '../@ohos.app.ability.OpenLinkOptions'; import type ConfigurationConstant from '../@ohos.app.ability.ConfigurationConstant'; import type UIServiceProxy from './UIServiceProxy'; import type UIServiceExtensionConnectCallback from './UIServiceExtensionConnectCallback'; /*** endif */ /*** if arkts 1.2 */ import { AbilityResult } from '../ability/abilityResult'; /*** endif */ /** * The context of UI extension. It allows access to UIExtension-specific resources. * * @extends ExtensionContext * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'10', '1.2':'20'} * @arkts 1.1&1.2 */ declare class UIExtensionContext extends ExtensionContext { /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { AsyncCallback } callback - The callback of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { AsyncCallback } callback - The callback of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { AsyncCallback } callback - The callback of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'14', '1.2':'20'} * @arkts 1.1&1.2 */ startAbility(want: Want, callback: AsyncCallback): void; /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } options - Indicates the start options. * @param { AsyncCallback } callback - The callback of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } options - Indicates the start options. * @param { AsyncCallback } callback - The callback of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } options - Indicates the start options. * @param { AsyncCallback } callback - The callback of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'14', '1.2':'20'} * @arkts 1.1&1.2 */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'14', '1.2':'20'} * @arkts 1.1&1.2 */ startAbility(want: Want, options?: StartOptions): Promise; /** * UI extension uses this method to start a specific ability by implicit want.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { string } link - Indicates the ability to start. * @param { OpenLinkOptions } [options] - Indicates the open link options. * @param { AsyncCallback } [callback] - The callback is used to return the ability result. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16200001 - The caller has been released. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ openLink(link: string, options?: OpenLinkOptions, callback?: AsyncCallback): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 14 */ startAbilityForResult(want: Want, callback: AsyncCallback): void; /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } options - Indicates the start options. * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } options - Indicates the start options. * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } options - Indicates the start options. * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 14 */ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } Returns the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } Returns the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } Returns the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 14 */ startAbilityForResult(want: Want, options?: StartOptions): Promise; /** * Starts a new ability using the original caller information, and returns the execution result when the ability * is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } Returns the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 12 */ /** * Starts a new ability using the original caller information, and returns the execution result when the ability * is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * * @param { Want } want - Indicates the ability to start. * @param { StartOptions } [options] - Indicates the start options. * @returns { Promise } Returns the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @throws { BusinessError } 16000071 - App clone is not supported. * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. * @throws { BusinessError } 16000078 - The multi-instance is not supported. * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 14 */ startAbilityForResultAsCaller(want: Want, options?: StartOptions): Promise; /** * Connects the current ability to an service extension ability. * If the target service extension ability is visible, you can connect the target service extension ability; * If the target service extension ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - The element name of the service ability * @param { ConnectOptions } options - The remote object instance * @returns { number } Returns the number code of the ability connected * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16000070 - The extension cannot start the service. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; /** * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. * * @param { number } connection - The number code of the ability connected * @param { AsyncCallback } callback - The callback of disconnectAbility. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; /** * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. * * @param { number } connection - The number code of the ability connected * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 10 */ disconnectServiceExtensionAbility(connection: number): Promise; /** * Report to system when the extension is drawn completed. * * @param { AsyncCallback } callback - The callback of startUIExtensionAbility. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ reportDrawnCompleted(callback: AsyncCallback): void; /** * Destroys the UI extension. * * @param { AsyncCallback } callback - The callback of terminateSelf. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ terminateSelf(callback: AsyncCallback): void; /** * Destroys the UI extension. * * @returns { Promise } The promise returned by the function. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ terminateSelf(): Promise; /** * Destroys the UI extension while returning the specified result code and data to the caller. * * @param { AbilityResult } parameter - Indicates the result to return. * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; /** * Destroys the UI extension while returning the specified result code and data to the caller. * * @param { AbilityResult } parameter - Indicates the result to return. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ terminateSelfWithResult(parameter: AbilityResult): Promise; /** * Full-screen pop-us startup atomic service. * * @param { string } appId - Globally unique identifier of an application, which is allocated by the cloud. * @param { AtomicServiceOptions } [options] - Indicates the atomic service start options. * @returns { Promise } Returns the result of openAtomicService. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000003 - The specified ID does not exist. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000069 - The extension cannot start the third party application. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 12 */ openAtomicService(appId: string, options?: AtomicServiceOptions): Promise; /** * Starts a UI service extension ability. * If the target UI service extension ability is visible, you can start the target UI service extension ability; * If the target UI service extension ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UI service extension ability. * * @param { Want } want - Indicates the want info to start. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 14 */ startUIServiceExtensionAbility(want: Want): Promise; /** * Connects to a UI service extension ability. * If the target UI service extension ability is visible, you can connect the target UI service extension ability; * If the target UI service extension ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible UI service extension ability. * * @param { Want } want - Indicates the want info to connect. * @param { UIServiceExtensionConnectCallback } callback - The callback of connection. * @returns { Promise } The promise to get UIServiceProxy. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16000055 - Installation-free timed out. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 14 */ connectUIServiceExtensionAbility(want: Want, callback: UIServiceExtensionConnectCallback) : Promise; /** * Disconnects from a UI service extension, in contrast to {@link connectUIServiceExtensionAbility}. * * @param { UIServiceProxy } proxy - The UI service proxy return by connectUIServiceExtensionAbility. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 14 */ disconnectUIServiceExtensionAbility(proxy: UIServiceProxy): Promise; /** * Starts a new service extension ability. * If the target service extension ability is visible, you can start the target service extension ability; * If the target service extension ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @param { Want } want - Indicates the want info to start. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 18 */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. * If the target service extension ability is visible, you can start the target service extension ability; * If the target service extension ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS * @param { Want } want - Indicates the want info to start. * @param { number } accountId - Indicates the account to start. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. * @throws { BusinessError } 16000004 - Cannot start an invisible component. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000012 - The application is controlled. * @throws { BusinessError } 16000013 - The application is controlled by EDM. * @throws { BusinessError } 16000019 - No matching ability is found. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 18 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Set the uiextension to either not allow being covered by the host page or allow it. * * @param { boolean } isForbidden - Indicates the bool value of uiextension can be covered by host page. * True indicates not allowing. * False indicates allowing. * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 15 */ setHostPageOverlayForbidden(isForbidden: boolean) : void; /** * Set colorMode of uiextension. * * @param { ConfigurationConstant.ColorMode } colorMode - Color mode. * @throws { BusinessError } 16000011 - The context does not exist. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 18 */ setColorMode(colorMode: ConfigurationConstant.ColorMode): void; /** * Starts multi UIAbility simultaneously. If the caller application is in foreground, you can use * this method to start abilities; If the caller application is in the background, you need to apply * for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. If the target ability is visible, * you can start the target ability; If the target ability is invisible,you need to apply for * permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * * @param { Array } wantList - Indicates the want info list to start. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 201 - The application does not have permission to call the interface. * @throws { BusinessError } 202 - Not system application. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000004 - Failed to start the invisible ability. * @throws { BusinessError } 16000005 - The specified process does not have the permission. * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. * @throws { BusinessError } 16000008 - The crowdtesting application expires. * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000011 - The context does not exist. * @throws { BusinessError } 16000050 - Internal error. * @throws { BusinessError } 16200001 - The caller has been released. * @throws { BusinessError } 16000073 - The app clone index is invalid. * @throws { BusinessError } 16000076 - The app instance key is invalid. * @throws { BusinessError } 16000080 - Creating a new instance is not supported. * @throws { BusinessError } 16000120 - A maximum of four UIAbility instances can be started simultaneously. * The current parameter exceeds the maximum number or is less than 1. * @throws { BusinessError } 16000121 - The target component type is not a UIAbility. * @throws { BusinessError } 16000122 - The target component is blocked by the system module and * does not support startup. * @throws { BusinessError } 16000123 - Implicit startup is not supported. * @throws { BusinessError } 16000124 - Starting a remote UIAbility is not supported. * @throws { BusinessError } 16000125 - Starting a plugin UIAbility is not supported. * @throws { BusinessError } 16000126 - Starting DLP files is not supported. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 20 */ startUIAbilities(wantList: Array): Promise; } export default UIExtensionContext;