1/* 2 * Copyright (c) 2022-2024 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'; 22import { ConnectOptions } from '../ability/connectOptions'; 23import { Caller } from '../@ohos.app.ability.UIAbility'; 24import ExtensionContext from './ExtensionContext'; 25import Want from '../@ohos.app.ability.Want'; 26import StartOptions from '../@ohos.app.ability.StartOptions'; 27import OpenLinkOptions from '../@ohos.app.ability.OpenLinkOptions'; 28import type AtomicServiceOptions from '../@ohos.app.ability.AtomicServiceOptions'; 29 30/** 31 * The context of service extension. It allows access to 32 * serviceExtension-specific resources. 33 * 34 * @extends ExtensionContext 35 * @syscap SystemCapability.Ability.AbilityRuntime.Core 36 * @systemapi 37 * @stagemodelonly 38 * @since 9 39 */ 40export default class ServiceExtensionContext extends ExtensionContext { 41 /** 42 * Service extension uses this method to start a specific ability. 43 * 44 * @param { Want } want - Indicates the ability to start. 45 * @param { AsyncCallback<void> } callback - The callback of startAbility. 46 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 47 * 2. Incorrect parameter types; 3. Parameter verification failed. 48 * @throws { BusinessError } 16000001 - The specified ability does not exist. 49 * @throws { BusinessError } 16000002 - Incorrect ability type. 50 * @throws { BusinessError } 16000004 - Can not start invisible component. 51 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 52 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 53 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 54 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 55 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 56 * @throws { BusinessError } 16000011 - The context does not exist. 57 * @throws { BusinessError } 16000050 - Internal error. 58 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 59 * @throws { BusinessError } 16000055 - Installation-free timed out. 60 * @throws { BusinessError } 16200001 - The caller has been released. 61 * @syscap SystemCapability.Ability.AbilityRuntime.Core 62 * @systemapi 63 * @stagemodelonly 64 * @since 9 65 */ 66 /** 67 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 68 * you can use this method to start ability; If the caller application is in the background, 69 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 70 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 71 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 72 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 73 * 74 * @param { Want } want - Indicates the ability to start. 75 * @param { AsyncCallback<void> } callback - The callback of startAbility. 76 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 77 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 78 * 2. Incorrect parameter types; 3. Parameter verification failed. 79 * @throws { BusinessError } 16000001 - The specified ability does not exist. 80 * @throws { BusinessError } 16000002 - Incorrect ability type. 81 * @throws { BusinessError } 16000004 - Can not start invisible component. 82 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 83 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 84 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 85 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 86 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 87 * @throws { BusinessError } 16000011 - The context does not exist. 88 * @throws { BusinessError } 16000012 - The application is controlled. 89 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 90 * @throws { BusinessError } 16000050 - Internal error. 91 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 92 * @throws { BusinessError } 16000055 - Installation-free timed out. 93 * @throws { BusinessError } 16200001 - The caller has been released. 94 * @syscap SystemCapability.Ability.AbilityRuntime.Core 95 * @systemapi 96 * @stagemodelonly 97 * @since 10 98 */ 99 /** 100 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 101 * you can use this method to start ability; If the caller application is in the background, 102 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 103 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 104 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 105 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 106 * 107 * @param { Want } want - Indicates the ability to start. 108 * @param { AsyncCallback<void> } callback - The callback of startAbility. 109 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 110 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 111 * 2. Incorrect parameter types; 3. Parameter verification failed. 112 * @throws { BusinessError } 16000001 - The specified ability does not exist. 113 * @throws { BusinessError } 16000002 - Incorrect ability type. 114 * @throws { BusinessError } 16000004 - Can not start invisible component. 115 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 116 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 117 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 118 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 119 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 120 * @throws { BusinessError } 16000011 - The context does not exist. 121 * @throws { BusinessError } 16000012 - The application is controlled. 122 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 123 * @throws { BusinessError } 16000019 - Can not match any component. 124 * @throws { BusinessError } 16000050 - Internal error. 125 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 126 * @throws { BusinessError } 16000055 - Installation-free timed out. 127 * @throws { BusinessError } 16200001 - The caller has been released. 128 * @throws { BusinessError } 16000073 - The app clone index is invalid. 129 * @syscap SystemCapability.Ability.AbilityRuntime.Core 130 * @systemapi 131 * @stagemodelonly 132 * @since 12 133 */ 134 /** 135 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 136 * you can use this method to start ability; If the caller application is in the background, 137 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 138 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 139 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 140 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 141 * 142 * @param { Want } want - Indicates the ability to start. 143 * @param { AsyncCallback<void> } callback - The callback of startAbility. 144 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 145 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 146 * 2. Incorrect parameter types; 3. Parameter verification failed. 147 * @throws { BusinessError } 16000001 - The specified ability does not exist. 148 * @throws { BusinessError } 16000002 - Incorrect ability type. 149 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 150 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 151 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 152 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 153 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 154 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 155 * @throws { BusinessError } 16000011 - The context does not exist. 156 * @throws { BusinessError } 16000012 - The application is controlled. 157 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 158 * @throws { BusinessError } 16000019 - No matching ability is found. 159 * @throws { BusinessError } 16000050 - Internal error. 160 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 161 * @throws { BusinessError } 16000055 - Installation-free timed out. 162 * @throws { BusinessError } 16000071 - App clone is not supported. 163 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 164 * @throws { BusinessError } 16000073 - The app clone index is invalid. 165 * @throws { BusinessError } 16000076 - The app instance key is invalid. 166 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 167 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 168 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 169 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 170 * @throws { BusinessError } 16200001 - The caller has been released. 171 * @syscap SystemCapability.Ability.AbilityRuntime.Core 172 * @systemapi 173 * @stagemodelonly 174 * @since 14 175 */ 176 startAbility(want: Want, callback: AsyncCallback<void>): void; 177 178 /** 179 * Service extension uses this method to start a specific ability. 180 * 181 * @param { Want } want - Indicates the ability to start. 182 * @param { StartOptions } options - Indicates the start options. 183 * @param { AsyncCallback<void> } callback - The callback of startAbility. 184 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 185 * 2. Incorrect parameter types; 3. Parameter verification failed. 186 * @throws { BusinessError } 16000001 - The specified ability does not exist. 187 * @throws { BusinessError } 16000002 - Incorrect ability type. 188 * @throws { BusinessError } 16000004 - Can not start invisible component. 189 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 190 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 191 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 192 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 193 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 194 * @throws { BusinessError } 16000011 - The context does not exist. 195 * @throws { BusinessError } 16000050 - Internal error. 196 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 197 * @throws { BusinessError } 16000055 - Installation-free timed out. 198 * @throws { BusinessError } 16200001 - The caller has been released. 199 * @syscap SystemCapability.Ability.AbilityRuntime.Core 200 * @systemapi 201 * @stagemodelonly 202 * @since 9 203 */ 204 /** 205 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 206 * you can use this method to start ability; If the caller application is in the background, 207 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 208 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 209 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 210 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 211 * 212 * @param { Want } want - Indicates the ability to start. 213 * @param { StartOptions } options - Indicates the start options. 214 * @param { AsyncCallback<void> } callback - The callback of startAbility. 215 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 216 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 217 * 2. Incorrect parameter types; 3. Parameter verification failed. 218 * @throws { BusinessError } 16000001 - The specified ability does not exist. 219 * @throws { BusinessError } 16000004 - Can not start invisible component. 220 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 221 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 222 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 223 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 224 * @throws { BusinessError } 16000011 - The context does not exist. 225 * @throws { BusinessError } 16000012 - The application is controlled. 226 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 227 * @throws { BusinessError } 16000050 - Internal error. 228 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 229 * @throws { BusinessError } 16000055 - Installation-free timed out. 230 * @throws { BusinessError } 16200001 - The caller has been released. 231 * @syscap SystemCapability.Ability.AbilityRuntime.Core 232 * @systemapi 233 * @stagemodelonly 234 * @since 10 235 */ 236 /** 237 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 238 * you can use this method to start ability; If the caller application is in the background, 239 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 240 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 241 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 242 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 243 * 244 * @param { Want } want - Indicates the ability to start. 245 * @param { StartOptions } options - Indicates the start options. 246 * @param { AsyncCallback<void> } callback - The callback of startAbility. 247 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 248 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 249 * 2. Incorrect parameter types; 3. Parameter verification failed. 250 * @throws { BusinessError } 16000001 - The specified ability does not exist. 251 * @throws { BusinessError } 16000004 - Can not start invisible component. 252 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 253 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 254 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 255 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 256 * @throws { BusinessError } 16000011 - The context does not exist. 257 * @throws { BusinessError } 16000012 - The application is controlled. 258 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 259 * @throws { BusinessError } 16000019 - Can not match any component. 260 * @throws { BusinessError } 16000050 - Internal error. 261 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 262 * @throws { BusinessError } 16000055 - Installation-free timed out. 263 * @throws { BusinessError } 16200001 - The caller has been released. 264 * @throws { BusinessError } 16000073 - The app clone index is invalid. 265 * @syscap SystemCapability.Ability.AbilityRuntime.Core 266 * @systemapi 267 * @stagemodelonly 268 * @since 12 269 */ 270 /** 271 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 272 * you can use this method to start ability; If the caller application is in the background, 273 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 274 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 275 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 276 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 277 * 278 * @param { Want } want - Indicates the ability to start. 279 * @param { StartOptions } options - Indicates the start options. 280 * @param { AsyncCallback<void> } callback - The callback of startAbility. 281 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 283 * 2. Incorrect parameter types; 3. Parameter verification failed. 284 * @throws { BusinessError } 16000001 - The specified ability does not exist. 285 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 286 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 287 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 288 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 289 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 290 * @throws { BusinessError } 16000011 - The context does not exist. 291 * @throws { BusinessError } 16000012 - The application is controlled. 292 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 293 * @throws { BusinessError } 16000019 - No matching ability is found. 294 * @throws { BusinessError } 16000050 - Internal error. 295 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 296 * @throws { BusinessError } 16000055 - Installation-free timed out. 297 * @throws { BusinessError } 16000071 - App clone is not supported. 298 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 299 * @throws { BusinessError } 16000073 - The app clone index is invalid. 300 * @throws { BusinessError } 16000076 - The app instance key is invalid. 301 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 302 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 303 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 304 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 305 * @throws { BusinessError } 16200001 - The caller has been released. 306 * @syscap SystemCapability.Ability.AbilityRuntime.Core 307 * @systemapi 308 * @stagemodelonly 309 * @since 14 310 */ 311 startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 312 313 /** 314 * Service extension uses this method to start a specific ability. 315 * 316 * @param { Want } want - Indicates the ability to start. 317 * @param { StartOptions } options - Indicates the start options. 318 * @returns { Promise<void> } The promise returned by the function. 319 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 320 * 2. Incorrect parameter types; 3. Parameter verification failed. 321 * @throws { BusinessError } 16000001 - The specified ability does not exist. 322 * @throws { BusinessError } 16000002 - Incorrect ability type. 323 * @throws { BusinessError } 16000004 - Can not start invisible component. 324 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 325 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 326 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 327 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 328 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 329 * @throws { BusinessError } 16000011 - The context does not exist. 330 * @throws { BusinessError } 16000050 - Internal error. 331 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 332 * @throws { BusinessError } 16000055 - Installation-free timed out. 333 * @throws { BusinessError } 16200001 - The caller has been released. 334 * @syscap SystemCapability.Ability.AbilityRuntime.Core 335 * @systemapi 336 * @stagemodelonly 337 * @since 9 338 */ 339 /** 340 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 341 * you can use this method to start ability; If the caller application is in the background, 342 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 343 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 344 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 345 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 346 * 347 * @param { Want } want - Indicates the ability to start. 348 * @param { StartOptions } [options] - Indicates the start options. 349 * @returns { Promise<void> } The promise returned by the function. 350 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 351 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 352 * 2. Incorrect parameter types; 3. Parameter verification failed. 353 * @throws { BusinessError } 16000001 - The specified ability does not exist. 354 * @throws { BusinessError } 16000002 - Incorrect ability type. 355 * @throws { BusinessError } 16000004 - Can not start invisible component. 356 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 357 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 358 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 359 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 360 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 361 * @throws { BusinessError } 16000011 - The context does not exist. 362 * @throws { BusinessError } 16000012 - The application is controlled. 363 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 364 * @throws { BusinessError } 16000050 - Internal error. 365 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 366 * @throws { BusinessError } 16000055 - Installation-free timed out. 367 * @throws { BusinessError } 16200001 - The caller has been released. 368 * @syscap SystemCapability.Ability.AbilityRuntime.Core 369 * @systemapi 370 * @stagemodelonly 371 * @since 10 372 */ 373 /** 374 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 375 * you can use this method to start ability; If the caller application is in the background, 376 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 377 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 378 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 379 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 380 * 381 * @param { Want } want - Indicates the ability to start. 382 * @param { StartOptions } [options] - Indicates the start options. 383 * @returns { Promise<void> } The promise returned by the function. 384 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 385 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 386 * 2. Incorrect parameter types; 3. Parameter verification failed. 387 * @throws { BusinessError } 16000001 - The specified ability does not exist. 388 * @throws { BusinessError } 16000002 - Incorrect ability type. 389 * @throws { BusinessError } 16000004 - Can not start invisible component. 390 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 391 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 392 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 393 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 394 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 395 * @throws { BusinessError } 16000011 - The context does not exist. 396 * @throws { BusinessError } 16000012 - The application is controlled. 397 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 398 * @throws { BusinessError } 16000019 - Can not match any component. 399 * @throws { BusinessError } 16000050 - Internal error. 400 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 401 * @throws { BusinessError } 16000055 - Installation-free timed out. 402 * @throws { BusinessError } 16200001 - The caller has been released. 403 * @throws { BusinessError } 16000073 - The app clone index is invalid. 404 * @syscap SystemCapability.Ability.AbilityRuntime.Core 405 * @systemapi 406 * @stagemodelonly 407 * @since 12 408 */ 409 /** 410 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 411 * you can use this method to start ability; If the caller application is in the background, 412 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 413 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 414 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 415 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 416 * 417 * @param { Want } want - Indicates the ability to start. 418 * @param { StartOptions } [options] - Indicates the start options. 419 * @returns { Promise<void> } The promise returned by the function. 420 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 421 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 422 * 2. Incorrect parameter types; 3. Parameter verification failed. 423 * @throws { BusinessError } 16000001 - The specified ability does not exist. 424 * @throws { BusinessError } 16000002 - Incorrect ability type. 425 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 426 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 427 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 428 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 429 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 430 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 431 * @throws { BusinessError } 16000011 - The context does not exist. 432 * @throws { BusinessError } 16000012 - The application is controlled. 433 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 434 * @throws { BusinessError } 16000019 - No matching ability is found. 435 * @throws { BusinessError } 16000050 - Internal error. 436 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 437 * @throws { BusinessError } 16000055 - Installation-free timed out. 438 * @throws { BusinessError } 16000071 - App clone is not supported. 439 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 440 * @throws { BusinessError } 16000073 - The app clone index is invalid. 441 * @throws { BusinessError } 16000076 - The app instance key is invalid. 442 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 443 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 444 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 445 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 446 * @throws { BusinessError } 16200001 - The caller has been released. 447 * @syscap SystemCapability.Ability.AbilityRuntime.Core 448 * @systemapi 449 * @stagemodelonly 450 * @since 14 451 */ 452 startAbility(want: Want, options?: StartOptions): Promise<void>; 453 454 /** 455 * Service extension uses this method to start a specific ability by implicit want. If the caller application is in foreground, 456 * you can use this method to start ability; If the caller application is in the background, 457 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 458 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 459 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 460 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 461 * 462 * @param { string } link - Indicates the ability to start. 463 * @param { OpenLinkOptions } [options] - Indicates the open link options. 464 * @returns { Promise<void> } The promise returned by the function. 465 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 466 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 467 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 468 * 2. Incorrect parameter types; 3. Parameter verification failed. 469 * @throws { BusinessError } 16000001 - The specified ability does not exist. 470 * @throws { BusinessError } 16000002 - Incorrect ability type. 471 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 472 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 473 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 474 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 475 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 476 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 477 * @throws { BusinessError } 16000011 - The context does not exist. 478 * @throws { BusinessError } 16000012 - The application is controlled. 479 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 480 * @throws { BusinessError } 16000019 - No matching ability is found. 481 * @throws { BusinessError } 16200001 - The caller has been released. 482 * @syscap SystemCapability.Ability.AbilityRuntime.Core 483 * @systemapi 484 * @stagemodelonly 485 * @since 12 486 */ 487 openLink(link: string, options?: OpenLinkOptions): Promise<void>; 488 489 /** 490 * Service extension start an ability using the original caller information. If the caller application is in 491 * foreground, you can use this method to start ability; If the caller application is in the background, 492 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 493 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 494 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 495 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 496 * 497 * @param { Want } want - Indicates the ability to start. 498 * @param { AsyncCallback<void> } callback - The callback of startAbility. 499 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 500 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 501 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 502 * 2. Incorrect parameter types; 3. Parameter verification failed. 503 * @throws { BusinessError } 16000001 - The specified ability does not exist. 504 * @throws { BusinessError } 16000002 - Incorrect ability type. 505 * @throws { BusinessError } 16000004 - Can not start invisible component. 506 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 507 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 508 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 509 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 510 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 511 * @throws { BusinessError } 16000011 - The context does not exist. 512 * @throws { BusinessError } 16000012 - The application is controlled. 513 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 514 * @throws { BusinessError } 16000050 - Internal error. 515 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 516 * @throws { BusinessError } 16000055 - Installation-free timed out. 517 * @throws { BusinessError } 16200001 - The caller has been released. 518 * @syscap SystemCapability.Ability.AbilityRuntime.Core 519 * @systemapi 520 * @stagemodelonly 521 * @since 10 522 */ 523 /** 524 * Service extension start an ability using the original caller information. If the caller application is in 525 * foreground, you can use this method to start ability; If the caller application is in the background, 526 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 527 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 528 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 529 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 530 * 531 * @param { Want } want - Indicates the ability to start. 532 * @param { AsyncCallback<void> } callback - The callback of startAbility. 533 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 534 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 535 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 536 * 2. Incorrect parameter types; 3. Parameter verification failed. 537 * @throws { BusinessError } 16000001 - The specified ability does not exist. 538 * @throws { BusinessError } 16000002 - Incorrect ability type. 539 * @throws { BusinessError } 16000004 - Can not start invisible component. 540 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 541 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 542 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 543 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 544 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 545 * @throws { BusinessError } 16000011 - The context does not exist. 546 * @throws { BusinessError } 16000012 - The application is controlled. 547 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 548 * @throws { BusinessError } 16000050 - Internal error. 549 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 550 * @throws { BusinessError } 16000055 - Installation-free timed out. 551 * @throws { BusinessError } 16200001 - The caller has been released. 552 * @throws { BusinessError } 16000073 - The app clone index is invalid. 553 * @syscap SystemCapability.Ability.AbilityRuntime.Core 554 * @systemapi 555 * @stagemodelonly 556 * @since 12 557 */ 558 /** 559 * Service extension start an ability using the original caller information. If the caller application is in 560 * foreground, you can use this method to start ability; If the caller application is in the background, 561 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 562 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 563 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 564 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 565 * 566 * @param { Want } want - Indicates the ability to start. 567 * @param { AsyncCallback<void> } callback - The callback of startAbility. 568 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 569 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 570 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 571 * 2. Incorrect parameter types; 3. Parameter verification failed. 572 * @throws { BusinessError } 16000001 - The specified ability does not exist. 573 * @throws { BusinessError } 16000002 - Incorrect ability type. 574 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 575 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 576 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 577 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 578 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 579 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 580 * @throws { BusinessError } 16000011 - The context does not exist. 581 * @throws { BusinessError } 16000012 - The application is controlled. 582 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 583 * @throws { BusinessError } 16000050 - Internal error. 584 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 585 * @throws { BusinessError } 16000055 - Installation-free timed out. 586 * @throws { BusinessError } 16000071 - App clone is not supported. 587 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 588 * @throws { BusinessError } 16000073 - The app clone index is invalid. 589 * @throws { BusinessError } 16000076 - The app instance key is invalid. 590 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 591 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 592 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 593 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 594 * @throws { BusinessError } 16200001 - The caller has been released. 595 * @syscap SystemCapability.Ability.AbilityRuntime.Core 596 * @systemapi 597 * @stagemodelonly 598 * @since 14 599 */ 600 startAbilityAsCaller(want: Want, callback: AsyncCallback<void>): void; 601 602 /** 603 * Service extension start an ability using the original caller information. If the caller application is in 604 * foreground, you can use this method to start ability; If the caller application is in the background, 605 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 606 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 607 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 608 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 609 * 610 * @param { Want } want - Indicates the ability to start. 611 * @param { StartOptions } options - Indicates the start options. 612 * @param { AsyncCallback<void> } callback - The callback of startAbility. 613 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 614 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 615 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 616 * 2. Incorrect parameter types; 3. Parameter verification failed. 617 * @throws { BusinessError } 16000001 - The specified ability does not exist. 618 * @throws { BusinessError } 16000004 - Can not start invisible component. 619 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 620 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 621 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 622 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 623 * @throws { BusinessError } 16000011 - The context does not exist. 624 * @throws { BusinessError } 16000012 - The application is controlled. 625 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 626 * @throws { BusinessError } 16000050 - Internal error. 627 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 628 * @throws { BusinessError } 16000055 - Installation-free timed out. 629 * @throws { BusinessError } 16200001 - The caller has been released. 630 * @syscap SystemCapability.Ability.AbilityRuntime.Core 631 * @systemapi 632 * @stagemodelonly 633 * @since 10 634 */ 635 /** 636 * Service extension start an ability using the original caller information. If the caller application is in 637 * foreground, you can use this method to start ability; If the caller application is in the background, 638 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 639 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 640 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 641 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 642 * 643 * @param { Want } want - Indicates the ability to start. 644 * @param { StartOptions } options - Indicates the start options. 645 * @param { AsyncCallback<void> } callback - The callback of startAbility. 646 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 647 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 648 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 649 * 2. Incorrect parameter types; 3. Parameter verification failed. 650 * @throws { BusinessError } 16000001 - The specified ability does not exist. 651 * @throws { BusinessError } 16000004 - Can not start invisible component. 652 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 653 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 654 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 655 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 656 * @throws { BusinessError } 16000011 - The context does not exist. 657 * @throws { BusinessError } 16000012 - The application is controlled. 658 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 659 * @throws { BusinessError } 16000050 - Internal error. 660 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 661 * @throws { BusinessError } 16000055 - Installation-free timed out. 662 * @throws { BusinessError } 16200001 - The caller has been released. 663 * @throws { BusinessError } 16000073 - The app clone index is invalid. 664 * @syscap SystemCapability.Ability.AbilityRuntime.Core 665 * @systemapi 666 * @stagemodelonly 667 * @since 12 668 */ 669 /** 670 * Service extension start an ability using the original caller information. If the caller application is in 671 * foreground, you can use this method to start ability; If the caller application is in the background, 672 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 673 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 674 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 675 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 676 * 677 * @param { Want } want - Indicates the ability to start. 678 * @param { StartOptions } options - Indicates the start options. 679 * @param { AsyncCallback<void> } callback - The callback of startAbility. 680 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 681 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 682 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 683 * 2. Incorrect parameter types; 3. Parameter verification failed. 684 * @throws { BusinessError } 16000001 - The specified ability does not exist. 685 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 686 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 687 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 688 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 689 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 690 * @throws { BusinessError } 16000011 - The context does not exist. 691 * @throws { BusinessError } 16000012 - The application is controlled. 692 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 693 * @throws { BusinessError } 16000050 - Internal error. 694 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 695 * @throws { BusinessError } 16000055 - Installation-free timed out. 696 * @throws { BusinessError } 16000071 - App clone is not supported. 697 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 698 * @throws { BusinessError } 16000073 - The app clone index is invalid. 699 * @throws { BusinessError } 16000076 - The app instance key is invalid. 700 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 701 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 702 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 703 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 704 * @throws { BusinessError } 16200001 - The caller has been released. 705 * @syscap SystemCapability.Ability.AbilityRuntime.Core 706 * @systemapi 707 * @stagemodelonly 708 * @since 14 709 */ 710 startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 711 712 /** 713 * Service extension start an ability using the original caller information. If the caller application is in 714 * foreground, you can use this method to start ability; If the caller application is in the background, 715 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 716 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 717 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 718 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 719 * 720 * @param { Want } want - Indicates the ability to start. 721 * @param { StartOptions } options - Indicates the start options. 722 * @returns { Promise<void> } The promise returned by the function. 723 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 724 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 725 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 726 * 2. Incorrect parameter types; 3. Parameter verification failed. 727 * @throws { BusinessError } 16000001 - The specified ability does not exist. 728 * @throws { BusinessError } 16000002 - Incorrect ability type. 729 * @throws { BusinessError } 16000004 - Can not start invisible component. 730 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 731 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 732 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 733 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 734 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 735 * @throws { BusinessError } 16000011 - The context does not exist. 736 * @throws { BusinessError } 16000012 - The application is controlled. 737 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 738 * @throws { BusinessError } 16000050 - Internal error. 739 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 740 * @throws { BusinessError } 16000055 - Installation-free timed out. 741 * @throws { BusinessError } 16200001 - The caller has been released. 742 * @syscap SystemCapability.Ability.AbilityRuntime.Core 743 * @systemapi 744 * @stagemodelonly 745 * @since 10 746 */ 747 /** 748 * Service extension start an ability using the original caller information. If the caller application is in 749 * foreground, you can use this method to start ability; If the caller application is in the background, 750 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 751 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 752 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 753 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 754 * 755 * @param { Want } want - Indicates the ability to start. 756 * @param { StartOptions } options - Indicates the start options. 757 * @returns { Promise<void> } The promise returned by the function. 758 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 759 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 760 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 761 * 2. Incorrect parameter types; 3. Parameter verification failed. 762 * @throws { BusinessError } 16000001 - The specified ability does not exist. 763 * @throws { BusinessError } 16000002 - Incorrect ability type. 764 * @throws { BusinessError } 16000004 - Can not start invisible component. 765 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 766 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 767 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 768 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 769 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 770 * @throws { BusinessError } 16000011 - The context does not exist. 771 * @throws { BusinessError } 16000012 - The application is controlled. 772 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 773 * @throws { BusinessError } 16000050 - Internal error. 774 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 775 * @throws { BusinessError } 16000055 - Installation-free timed out. 776 * @throws { BusinessError } 16200001 - The caller has been released. 777 * @throws { BusinessError } 16000073 - The app clone index is invalid. 778 * @syscap SystemCapability.Ability.AbilityRuntime.Core 779 * @systemapi 780 * @stagemodelonly 781 * @since 12 782 */ 783 /** 784 * Service extension start an ability using the original caller information. If the caller application is in 785 * foreground, you can use this method to start ability; If the caller application is in the background, 786 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 787 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 788 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 789 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 790 * 791 * @param { Want } want - Indicates the ability to start. 792 * @param { StartOptions } options - Indicates the start options. 793 * @returns { Promise<void> } The promise returned by the function. 794 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 795 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 796 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 797 * 2. Incorrect parameter types; 3. Parameter verification failed. 798 * @throws { BusinessError } 16000001 - The specified ability does not exist. 799 * @throws { BusinessError } 16000002 - Incorrect ability type. 800 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 801 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 802 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 803 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 804 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 805 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 806 * @throws { BusinessError } 16000011 - The context does not exist. 807 * @throws { BusinessError } 16000012 - The application is controlled. 808 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 809 * @throws { BusinessError } 16000050 - Internal error. 810 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 811 * @throws { BusinessError } 16000055 - Installation-free timed out. 812 * @throws { BusinessError } 16000071 - App clone is not supported. 813 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 814 * @throws { BusinessError } 16000073 - The app clone index is invalid. 815 * @throws { BusinessError } 16000076 - The app instance key is invalid. 816 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 817 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 818 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 819 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 820 * @throws { BusinessError } 16200001 - The caller has been released. 821 * @syscap SystemCapability.Ability.AbilityRuntime.Core 822 * @systemapi 823 * @stagemodelonly 824 * @since 14 825 */ 826 startAbilityAsCaller(want: Want, options?: StartOptions): Promise<void>; 827 828 /** 829 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 830 * you can use this method to start ability; If the caller application is in the background, 831 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 832 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 833 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 834 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 835 * 836 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 837 * @param { Want } want - Indicates the ability to start. 838 * @param { number } accountId - Indicates the accountId to start. 839 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 840 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 841 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 842 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 843 * 2. Incorrect parameter types; 3. Parameter verification failed. 844 * @throws { BusinessError } 16000001 - The specified ability does not exist. 845 * @throws { BusinessError } 16000002 - Incorrect ability type. 846 * @throws { BusinessError } 16000004 - Can not start invisible component. 847 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 848 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 849 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 850 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 851 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 852 * @throws { BusinessError } 16000011 - The context does not exist. 853 * @throws { BusinessError } 16000012 - The application is controlled. 854 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 855 * @throws { BusinessError } 16000050 - Internal error. 856 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 857 * @throws { BusinessError } 16000055 - Installation-free timed out. 858 * @throws { BusinessError } 16200001 - The caller has been released. 859 * @syscap SystemCapability.Ability.AbilityRuntime.Core 860 * @systemapi 861 * @stagemodelonly 862 * @since 9 863 */ 864 /** 865 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 866 * you can use this method to start ability; If the caller application is in the background, 867 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 868 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 869 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 870 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 871 * 872 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 873 * @param { Want } want - Indicates the ability to start. 874 * @param { number } accountId - Indicates the accountId to start. 875 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 876 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 877 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 878 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 879 * 2. Incorrect parameter types; 3. Parameter verification failed. 880 * @throws { BusinessError } 16000001 - The specified ability does not exist. 881 * @throws { BusinessError } 16000002 - Incorrect ability type. 882 * @throws { BusinessError } 16000004 - Can not start invisible component. 883 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 884 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 885 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 886 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 887 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 888 * @throws { BusinessError } 16000011 - The context does not exist. 889 * @throws { BusinessError } 16000012 - The application is controlled. 890 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 891 * @throws { BusinessError } 16000019 - Can not match any component. 892 * @throws { BusinessError } 16000050 - Internal error. 893 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 894 * @throws { BusinessError } 16000055 - Installation-free timed out. 895 * @throws { BusinessError } 16200001 - The caller has been released. 896 * @throws { BusinessError } 16000073 - The app clone index is invalid. 897 * @syscap SystemCapability.Ability.AbilityRuntime.Core 898 * @systemapi 899 * @stagemodelonly 900 * @since 12 901 */ 902 /** 903 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 904 * you can use this method to start ability; If the caller application is in the background, 905 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 906 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 907 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 908 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 909 * 910 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 911 * @param { Want } want - Indicates the ability to start. 912 * @param { number } accountId - Indicates the accountId to start. 913 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 914 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 915 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 916 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 917 * 2. Incorrect parameter types; 3. Parameter verification failed. 918 * @throws { BusinessError } 16000001 - The specified ability does not exist. 919 * @throws { BusinessError } 16000002 - Incorrect ability type. 920 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 921 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 922 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 923 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 924 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 925 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 926 * @throws { BusinessError } 16000011 - The context does not exist. 927 * @throws { BusinessError } 16000012 - The application is controlled. 928 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 929 * @throws { BusinessError } 16000019 - No matching ability is found. 930 * @throws { BusinessError } 16000050 - Internal error. 931 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 932 * @throws { BusinessError } 16000055 - Installation-free timed out. 933 * @throws { BusinessError } 16000071 - App clone is not supported. 934 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 935 * @throws { BusinessError } 16000073 - The app clone index is invalid. 936 * @throws { BusinessError } 16000076 - The app instance key is invalid. 937 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 938 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 939 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 940 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 941 * @throws { BusinessError } 16200001 - The caller has been released. 942 * @syscap SystemCapability.Ability.AbilityRuntime.Core 943 * @systemapi 944 * @stagemodelonly 945 * @since 14 946 */ 947 startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 948 949 /** 950 * Service extension uses this method to start a specific ability with account. 951 * 952 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 953 * @param { Want } want - Indicates the ability to start. 954 * @param { number } accountId - Indicates the accountId to start. 955 * @param { StartOptions } options - Indicates the start options. 956 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 957 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 958 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 959 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 960 * 2. Incorrect parameter types; 3. Parameter verification failed. 961 * @throws { BusinessError } 16000001 - The specified ability does not exist. 962 * @throws { BusinessError } 16000002 - Incorrect ability type. 963 * @throws { BusinessError } 16000004 - Can not start invisible component. 964 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 965 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 966 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 967 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 968 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 969 * @throws { BusinessError } 16000011 - The context does not exist. 970 * @throws { BusinessError } 16000050 - Internal error. 971 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 972 * @throws { BusinessError } 16000055 - Installation-free timed out. 973 * @throws { BusinessError } 16200001 - The caller has been released. 974 * @syscap SystemCapability.Ability.AbilityRuntime.Core 975 * @systemapi 976 * @stagemodelonly 977 * @since 9 978 */ 979 /** 980 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 981 * you can use this method to start ability; If the caller application is in the background, 982 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 983 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 984 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 985 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 986 * 987 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 988 * @param { Want } want - Indicates the ability to start. 989 * @param { number } accountId - Indicates the accountId to start. 990 * @param { StartOptions } options - Indicates the start options. 991 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 992 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 993 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 994 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 995 * 2. Incorrect parameter types; 3. Parameter verification failed. 996 * @throws { BusinessError } 16000001 - The specified ability does not exist. 997 * @throws { BusinessError } 16000004 - Can not start invisible component. 998 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 999 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1000 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1001 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1002 * @throws { BusinessError } 16000011 - The context does not exist. 1003 * @throws { BusinessError } 16000012 - The application is controlled. 1004 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1005 * @throws { BusinessError } 16000050 - Internal error. 1006 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1007 * @throws { BusinessError } 16000055 - Installation-free timed out. 1008 * @throws { BusinessError } 16200001 - The caller has been released. 1009 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1010 * @systemapi 1011 * @stagemodelonly 1012 * @since 10 1013 */ 1014 /** 1015 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1016 * you can use this method to start ability; If the caller application is in the background, 1017 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1018 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1019 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1020 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1021 * 1022 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1023 * @param { Want } want - Indicates the ability to start. 1024 * @param { number } accountId - Indicates the accountId to start. 1025 * @param { StartOptions } options - Indicates the start options. 1026 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 1027 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1028 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1029 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1030 * 2. Incorrect parameter types; 3. Parameter verification failed. 1031 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1032 * @throws { BusinessError } 16000004 - Can not start invisible component. 1033 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1034 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1035 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1036 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1037 * @throws { BusinessError } 16000011 - The context does not exist. 1038 * @throws { BusinessError } 16000012 - The application is controlled. 1039 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1040 * @throws { BusinessError } 16000019 - Can not match any component. 1041 * @throws { BusinessError } 16000050 - Internal error. 1042 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1043 * @throws { BusinessError } 16000055 - Installation-free timed out. 1044 * @throws { BusinessError } 16200001 - The caller has been released. 1045 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1046 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1047 * @systemapi 1048 * @stagemodelonly 1049 * @since 12 1050 */ 1051 /** 1052 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1053 * you can use this method to start ability; If the caller application is in the background, 1054 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1055 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1056 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1057 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1058 * 1059 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1060 * @param { Want } want - Indicates the ability to start. 1061 * @param { number } accountId - Indicates the accountId to start. 1062 * @param { StartOptions } options - Indicates the start options. 1063 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 1064 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1065 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1066 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1067 * 2. Incorrect parameter types; 3. Parameter verification failed. 1068 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1069 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1070 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1071 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1072 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1073 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1074 * @throws { BusinessError } 16000011 - The context does not exist. 1075 * @throws { BusinessError } 16000012 - The application is controlled. 1076 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1077 * @throws { BusinessError } 16000019 - No matching ability is found. 1078 * @throws { BusinessError } 16000050 - Internal error. 1079 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1080 * @throws { BusinessError } 16000055 - Installation-free timed out. 1081 * @throws { BusinessError } 16000071 - App clone is not supported. 1082 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 1083 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1084 * @throws { BusinessError } 16000076 - The app instance key is invalid. 1085 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 1086 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 1087 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 1088 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 1089 * @throws { BusinessError } 16200001 - The caller has been released. 1090 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1091 * @systemapi 1092 * @stagemodelonly 1093 * @since 14 1094 */ 1095 startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void; 1096 1097 /** 1098 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1099 * you can use this method to start ability; If the caller application is in the background, 1100 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1101 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1102 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1103 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1104 * 1105 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1106 * @param { Want } want - Indicates the ability to start. 1107 * @param { number } accountId - Indicates the accountId to start. 1108 * @param { StartOptions } [options] - Indicates the start options. 1109 * @returns { Promise<void> } The promise returned by the function. 1110 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1111 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1112 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1113 * 2. Incorrect parameter types; 3. Parameter verification failed. 1114 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1115 * @throws { BusinessError } 16000002 - Incorrect ability type. 1116 * @throws { BusinessError } 16000004 - Can not start invisible component. 1117 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1118 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1119 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1120 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1121 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1122 * @throws { BusinessError } 16000011 - The context does not exist. 1123 * @throws { BusinessError } 16000012 - The application is controlled. 1124 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1125 * @throws { BusinessError } 16000050 - Internal error. 1126 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1127 * @throws { BusinessError } 16000055 - Installation-free timed out. 1128 * @throws { BusinessError } 16200001 - The caller has been released. 1129 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1130 * @systemapi 1131 * @stagemodelonly 1132 * @since 9 1133 */ 1134 /** 1135 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1136 * you can use this method to start ability; If the caller application is in the background, 1137 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1138 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1139 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1140 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1141 * 1142 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1143 * @param { Want } want - Indicates the ability to start. 1144 * @param { number } accountId - Indicates the accountId to start. 1145 * @param { StartOptions } [options] - Indicates the start options. 1146 * @returns { Promise<void> } The promise returned by the function. 1147 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1148 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1149 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1150 * 2. Incorrect parameter types; 3. Parameter verification failed. 1151 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1152 * @throws { BusinessError } 16000002 - Incorrect ability type. 1153 * @throws { BusinessError } 16000004 - Can not start invisible component. 1154 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1155 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1156 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1157 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1158 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 1159 * @throws { BusinessError } 16000011 - The context does not exist. 1160 * @throws { BusinessError } 16000012 - The application is controlled. 1161 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1162 * @throws { BusinessError } 16000019 - Can not match any component. 1163 * @throws { BusinessError } 16000050 - Internal error. 1164 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1165 * @throws { BusinessError } 16000055 - Installation-free timed out. 1166 * @throws { BusinessError } 16200001 - The caller has been released. 1167 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1168 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1169 * @systemapi 1170 * @stagemodelonly 1171 * @since 12 1172 */ 1173 /** 1174 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1175 * you can use this method to start ability; If the caller application is in the background, 1176 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1177 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1178 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1179 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1180 * 1181 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1182 * @param { Want } want - Indicates the ability to start. 1183 * @param { number } accountId - Indicates the accountId to start. 1184 * @param { StartOptions } [options] - Indicates the start options. 1185 * @returns { Promise<void> } The promise returned by the function. 1186 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1187 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1188 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1189 * 2. Incorrect parameter types; 3. Parameter verification failed. 1190 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1191 * @throws { BusinessError } 16000002 - Incorrect ability type. 1192 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1193 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1194 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1195 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1196 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1197 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 1198 * @throws { BusinessError } 16000011 - The context does not exist. 1199 * @throws { BusinessError } 16000012 - The application is controlled. 1200 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1201 * @throws { BusinessError } 16000019 - No matching ability is found. 1202 * @throws { BusinessError } 16000050 - Internal error. 1203 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1204 * @throws { BusinessError } 16000055 - Installation-free timed out. 1205 * @throws { BusinessError } 16000071 - App clone is not supported. 1206 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 1207 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1208 * @throws { BusinessError } 16000076 - The app instance key is invalid. 1209 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 1210 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 1211 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 1212 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 1213 * @throws { BusinessError } 16200001 - The caller has been released. 1214 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1215 * @systemapi 1216 * @stagemodelonly 1217 * @since 14 1218 */ 1219 startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>; 1220 1221 /** 1222 * Starts a new service extension ability. 1223 * 1224 * @param { Want } want - Indicates the want info to start. 1225 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 1226 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1227 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1228 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1229 * 2. Incorrect parameter types; 3. Parameter verification failed. 1230 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1231 * @throws { BusinessError } 16000002 - Incorrect ability type. 1232 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1233 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1234 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1235 * @throws { BusinessError } 16000011 - The context does not exist. 1236 * @throws { BusinessError } 16000050 - Internal error. 1237 * @throws { BusinessError } 16200001 - The caller has been released. 1238 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1239 * @systemapi 1240 * @stagemodelonly 1241 * @since 9 1242 */ 1243 /** 1244 * Starts a new service extension ability. 1245 * If the target service extension ability is visible, you can start the target service extension ability; 1246 * If the target service extension ability is invisible, 1247 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1248 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1249 * 1250 * @param { Want } want - Indicates the want info to start. 1251 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 1252 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1253 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1254 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1255 * 2. Incorrect parameter types; 3. Parameter verification failed. 1256 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1257 * @throws { BusinessError } 16000002 - Incorrect ability type. 1258 * @throws { BusinessError } 16000004 - Can not start invisible component. 1259 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1260 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1261 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1262 * @throws { BusinessError } 16000011 - The context does not exist. 1263 * @throws { BusinessError } 16000012 - The application is controlled. 1264 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1265 * @throws { BusinessError } 16000050 - Internal error. 1266 * @throws { BusinessError } 16200001 - The caller has been released. 1267 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1268 * @systemapi 1269 * @stagemodelonly 1270 * @since 10 1271 */ 1272 /** 1273 * Starts a new service extension ability. 1274 * If the target service extension ability is visible, you can start the target service extension ability; 1275 * If the target service extension ability is invisible, 1276 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1277 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1278 * 1279 * @param { Want } want - Indicates the want info to start. 1280 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 1281 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1282 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1283 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1284 * 2. Incorrect parameter types; 3. Parameter verification failed. 1285 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1286 * @throws { BusinessError } 16000002 - Incorrect ability type. 1287 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1288 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1289 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1290 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1291 * @throws { BusinessError } 16000011 - The context does not exist. 1292 * @throws { BusinessError } 16000012 - The application is controlled. 1293 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1294 * @throws { BusinessError } 16000019 - No matching ability is found. 1295 * @throws { BusinessError } 16000050 - Internal error. 1296 * @throws { BusinessError } 16200001 - The caller has been released. 1297 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1298 * @systemapi 1299 * @stagemodelonly 1300 * @since 12 1301 */ 1302 startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; 1303 1304 /** 1305 * Starts a new service extension ability. 1306 * 1307 * @param { Want } want - Indicates the want info to start. 1308 * @returns { Promise<void> } The promise returned by the function. 1309 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1310 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1311 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1312 * 2. Incorrect parameter types; 3. Parameter verification failed. 1313 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1314 * @throws { BusinessError } 16000002 - Incorrect ability type. 1315 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1316 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1317 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1318 * @throws { BusinessError } 16000011 - The context does not exist. 1319 * @throws { BusinessError } 16000050 - Internal error. 1320 * @throws { BusinessError } 16200001 - The caller has been released. 1321 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1322 * @systemapi 1323 * @stagemodelonly 1324 * @since 9 1325 */ 1326 /** 1327 * Starts a new service extension ability. 1328 * If the target service extension ability is visible, you can start the target service extension ability; 1329 * If the target service extension ability is invisible, 1330 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1331 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1332 * 1333 * @param { Want } want - Indicates the want info to start. 1334 * @returns { Promise<void> } The promise returned by the function. 1335 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1336 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1337 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1338 * 2. Incorrect parameter types; 3. Parameter verification failed. 1339 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1340 * @throws { BusinessError } 16000002 - Incorrect ability type. 1341 * @throws { BusinessError } 16000004 - Can not start invisible component. 1342 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1343 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1344 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1345 * @throws { BusinessError } 16000011 - The context does not exist. 1346 * @throws { BusinessError } 16000012 - The application is controlled. 1347 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1348 * @throws { BusinessError } 16000050 - Internal error. 1349 * @throws { BusinessError } 16200001 - The caller has been released. 1350 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1351 * @systemapi 1352 * @stagemodelonly 1353 * @since 10 1354 */ 1355 /** 1356 * Starts a new service extension ability. 1357 * If the target service extension ability is visible, you can start the target service extension ability; 1358 * If the target service extension ability is invisible, 1359 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1360 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1361 * 1362 * @param { Want } want - Indicates the want info to start. 1363 * @returns { Promise<void> } The promise returned by the function. 1364 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1365 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1366 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1367 * 2. Incorrect parameter types; 3. Parameter verification failed. 1368 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1369 * @throws { BusinessError } 16000002 - Incorrect ability type. 1370 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1371 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1372 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1373 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1374 * @throws { BusinessError } 16000011 - The context does not exist. 1375 * @throws { BusinessError } 16000012 - The application is controlled. 1376 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1377 * @throws { BusinessError } 16000019 - No matching ability is found. 1378 * @throws { BusinessError } 16000050 - Internal error. 1379 * @throws { BusinessError } 16200001 - The caller has been released. 1380 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1381 * @systemapi 1382 * @stagemodelonly 1383 * @since 12 1384 */ 1385 startServiceExtensionAbility(want: Want): Promise<void>; 1386 1387 /** 1388 * Starts a new service extension ability with account. 1389 * 1390 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1391 * @param { Want } want - Indicates the want info to start. 1392 * @param { number } accountId - Indicates the account to start. 1393 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1394 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1395 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1396 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1397 * 2. Incorrect parameter types; 3. Parameter verification failed. 1398 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1399 * @throws { BusinessError } 16000002 - Incorrect ability type. 1400 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1401 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1402 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1403 * @throws { BusinessError } 16000011 - The context does not exist. 1404 * @throws { BusinessError } 16000050 - Internal error. 1405 * @throws { BusinessError } 16200001 - The caller has been released. 1406 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1407 * @systemapi 1408 * @stagemodelonly 1409 * @since 9 1410 */ 1411 /** 1412 * Starts a new service extension ability with account. 1413 * If the target service extension ability is visible, you can start the target service extension ability; 1414 * If the target service extension ability is invisible, 1415 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1416 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1417 * 1418 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1419 * @param { Want } want - Indicates the want info to start. 1420 * @param { number } accountId - Indicates the account to start. 1421 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1422 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1423 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1424 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1425 * 2. Incorrect parameter types; 3. Parameter verification failed. 1426 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1427 * @throws { BusinessError } 16000002 - Incorrect ability type. 1428 * @throws { BusinessError } 16000004 - Can not start invisible component. 1429 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1430 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1431 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1432 * @throws { BusinessError } 16000011 - The context does not exist. 1433 * @throws { BusinessError } 16000012 - The application is controlled. 1434 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1435 * @throws { BusinessError } 16000050 - Internal error. 1436 * @throws { BusinessError } 16200001 - The caller has been released. 1437 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1438 * @systemapi 1439 * @stagemodelonly 1440 * @since 10 1441 */ 1442 /** 1443 * Starts a new service extension ability with account. 1444 * If the target service extension ability is visible, you can start the target service extension ability; 1445 * If the target service extension ability is invisible, 1446 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1447 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1448 * 1449 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1450 * @param { Want } want - Indicates the want info to start. 1451 * @param { number } accountId - Indicates the account to start. 1452 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1453 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1454 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1455 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1456 * 2. Incorrect parameter types; 3. Parameter verification failed. 1457 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1458 * @throws { BusinessError } 16000002 - Incorrect ability type. 1459 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1460 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1461 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1462 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1463 * @throws { BusinessError } 16000011 - The context does not exist. 1464 * @throws { BusinessError } 16000012 - The application is controlled. 1465 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1466 * @throws { BusinessError } 16000019 - No matching ability is found. 1467 * @throws { BusinessError } 16000050 - Internal error. 1468 * @throws { BusinessError } 16200001 - The caller has been released. 1469 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1470 * @systemapi 1471 * @stagemodelonly 1472 * @since 12 1473 */ 1474 startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 1475 1476 /** 1477 * Starts a new service extension ability with account. 1478 * 1479 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1480 * @param { Want } want - Indicates the want info to start. 1481 * @param { number } accountId - Indicates the account to start. 1482 * @returns { Promise<void> } The promise returned by the function. 1483 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1484 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1485 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1486 * 2. Incorrect parameter types; 3. Parameter verification failed. 1487 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1488 * @throws { BusinessError } 16000002 - Incorrect ability type. 1489 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1490 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1491 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1492 * @throws { BusinessError } 16000011 - The context does not exist. 1493 * @throws { BusinessError } 16000050 - Internal error. 1494 * @throws { BusinessError } 16200001 - The caller has been released. 1495 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1496 * @systemapi 1497 * @stagemodelonly 1498 * @since 9 1499 */ 1500 /** 1501 * Starts a new service extension ability with account. 1502 * If the target service extension ability is visible, you can start the target service extension ability; 1503 * If the target service extension ability is invisible, 1504 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1505 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1506 * 1507 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1508 * @param { Want } want - Indicates the want info to start. 1509 * @param { number } accountId - Indicates the account to start. 1510 * @returns { Promise<void> } The promise returned by the function. 1511 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1512 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1513 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1514 * 2. Incorrect parameter types; 3. Parameter verification failed. 1515 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1516 * @throws { BusinessError } 16000002 - Incorrect ability type. 1517 * @throws { BusinessError } 16000004 - Can not start invisible component. 1518 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1519 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1520 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1521 * @throws { BusinessError } 16000011 - The context does not exist. 1522 * @throws { BusinessError } 16000012 - The application is controlled. 1523 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1524 * @throws { BusinessError } 16000050 - Internal error. 1525 * @throws { BusinessError } 16200001 - The caller has been released. 1526 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1527 * @systemapi 1528 * @stagemodelonly 1529 * @since 10 1530 */ 1531 /** 1532 * Starts a new service extension ability with account. 1533 * If the target service extension ability is visible, you can start the target service extension ability; 1534 * If the target service extension ability is invisible, 1535 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1536 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1537 * 1538 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1539 * @param { Want } want - Indicates the want info to start. 1540 * @param { number } accountId - Indicates the account to start. 1541 * @returns { Promise<void> } The promise returned by the function. 1542 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1543 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1544 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1545 * 2. Incorrect parameter types; 3. Parameter verification failed. 1546 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1547 * @throws { BusinessError } 16000002 - Incorrect ability type. 1548 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1549 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1550 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1551 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1552 * @throws { BusinessError } 16000011 - The context does not exist. 1553 * @throws { BusinessError } 16000012 - The application is controlled. 1554 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1555 * @throws { BusinessError } 16000019 - No matching ability is found. 1556 * @throws { BusinessError } 16000050 - Internal error. 1557 * @throws { BusinessError } 16200001 - The caller has been released. 1558 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1559 * @systemapi 1560 * @stagemodelonly 1561 * @since 12 1562 */ 1563 startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>; 1564 1565 /** 1566 * Stops a service within the same application. 1567 * 1568 * @param { Want } want - Indicates the want info to start. 1569 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility. 1570 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1571 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1572 * 2. Incorrect parameter types; 3. Parameter verification failed. 1573 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1574 * @throws { BusinessError } 16000002 - Incorrect ability type. 1575 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1576 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1577 * @throws { BusinessError } 16000011 - The context does not exist. 1578 * @throws { BusinessError } 16000050 - Internal error. 1579 * @throws { BusinessError } 16200001 - The caller has been released. 1580 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1581 * @systemapi 1582 * @stagemodelonly 1583 * @since 9 1584 */ 1585 /** 1586 * Stops other service extension ability. 1587 * If the target service extension ability is visible, you can stop the target service extension ability; 1588 * If the target service extension ability is invisible, 1589 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1590 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1591 * 1592 * @param { Want } want - Indicates the want info to start. 1593 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility. 1594 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1595 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1596 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1597 * 2. Incorrect parameter types; 3. Parameter verification failed. 1598 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1599 * @throws { BusinessError } 16000002 - Incorrect ability type. 1600 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1601 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1602 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1603 * @throws { BusinessError } 16000011 - The context does not exist. 1604 * @throws { BusinessError } 16000050 - Internal error. 1605 * @throws { BusinessError } 16200001 - The caller has been released. 1606 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1607 * @systemapi 1608 * @stagemodelonly 1609 * @since 10 1610 */ 1611 stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; 1612 1613 /** 1614 * Stops a service within the same application. 1615 * 1616 * @param { Want } want - Indicates the want info to start. 1617 * @returns { Promise<void> } The promise returned by the function. 1618 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1619 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1620 * 2. Incorrect parameter types; 3. Parameter verification failed. 1621 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1622 * @throws { BusinessError } 16000002 - Incorrect ability type. 1623 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1624 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1625 * @throws { BusinessError } 16000011 - The context does not exist. 1626 * @throws { BusinessError } 16000050 - Internal error. 1627 * @throws { BusinessError } 16200001 - The caller has been released. 1628 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1629 * @systemapi 1630 * @stagemodelonly 1631 * @since 9 1632 */ 1633 /** 1634 * Stops other service extension ability. 1635 * If the target service extension ability is visible, you can stop the target service extension ability; 1636 * If the target service extension ability is invisible, 1637 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1638 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1639 * 1640 * @param { Want } want - Indicates the want info to start. 1641 * @returns { Promise<void> } The promise returned by the function. 1642 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1643 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1644 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1645 * 2. Incorrect parameter types; 3. Parameter verification failed. 1646 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1647 * @throws { BusinessError } 16000002 - Incorrect ability type. 1648 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1649 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1650 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1651 * @throws { BusinessError } 16000011 - The context does not exist. 1652 * @throws { BusinessError } 16000050 - Internal error. 1653 * @throws { BusinessError } 16200001 - The caller has been released. 1654 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1655 * @systemapi 1656 * @stagemodelonly 1657 * @since 10 1658 */ 1659 stopServiceExtensionAbility(want: Want): Promise<void>; 1660 1661 /** 1662 * Stops a service within the same application with account. 1663 * 1664 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1665 * @param { Want } want - Indicates the want info to start. 1666 * @param { number } accountId - Indicates the accountId to start. 1667 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount. 1668 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1669 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1670 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1671 * 2. Incorrect parameter types; 3. Parameter verification failed. 1672 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1673 * @throws { BusinessError } 16000002 - Incorrect ability type. 1674 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1675 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1676 * @throws { BusinessError } 16000011 - The context does not exist. 1677 * @throws { BusinessError } 16000050 - Internal error. 1678 * @throws { BusinessError } 16200001 - The caller has been released. 1679 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1680 * @systemapi 1681 * @stagemodelonly 1682 * @since 9 1683 */ 1684 /** 1685 * Stops other service extension ability with account. 1686 * If the target service extension ability is visible, you can stop the target service extension ability; 1687 * If the target service extension ability is invisible, 1688 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1689 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1690 * 1691 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1692 * @param { Want } want - Indicates the want info to start. 1693 * @param { number } accountId - Indicates the accountId to start. 1694 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount. 1695 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1696 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1697 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1698 * 2. Incorrect parameter types; 3. Parameter verification failed. 1699 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1700 * @throws { BusinessError } 16000002 - Incorrect ability type. 1701 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1702 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1703 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1704 * @throws { BusinessError } 16000011 - The context does not exist. 1705 * @throws { BusinessError } 16000050 - Internal error. 1706 * @throws { BusinessError } 16200001 - The caller has been released. 1707 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1708 * @systemapi 1709 * @stagemodelonly 1710 * @since 10 1711 */ 1712 stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 1713 1714 /** 1715 * Stops a service within the same application with account. 1716 * 1717 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1718 * @param { Want } want - Indicates the want info to start. 1719 * @param { number } accountId - Indicates the accountId to start. 1720 * @returns { Promise<void> } The promise returned by the function. 1721 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1722 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1723 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1724 * 2. Incorrect parameter types; 3. Parameter verification failed. 1725 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1726 * @throws { BusinessError } 16000002 - Incorrect ability type. 1727 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1728 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1729 * @throws { BusinessError } 16000011 - The context does not exist. 1730 * @throws { BusinessError } 16000050 - Internal error. 1731 * @throws { BusinessError } 16200001 - The caller has been released. 1732 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1733 * @systemapi 1734 * @stagemodelonly 1735 * @since 9 1736 */ 1737 /** 1738 * Stops other service extension ability with account. 1739 * If the target service extension ability is visible, you can stop the target service extension ability; 1740 * If the target service extension ability is invisible, 1741 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1742 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1743 * 1744 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1745 * @param { Want } want - Indicates the want info to start. 1746 * @param { number } accountId - Indicates the accountId to start. 1747 * @returns { Promise<void> } The promise returned by the function. 1748 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1749 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1750 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1751 * 2. Incorrect parameter types; 3. Parameter verification failed. 1752 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1753 * @throws { BusinessError } 16000002 - Incorrect ability type. 1754 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1755 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1756 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1757 * @throws { BusinessError } 16000011 - The context does not exist. 1758 * @throws { BusinessError } 16000050 - Internal error. 1759 * @throws { BusinessError } 16200001 - The caller has been released. 1760 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1761 * @systemapi 1762 * @stagemodelonly 1763 * @since 10 1764 */ 1765 stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>; 1766 1767 /** 1768 * Destroys this service extension. 1769 * 1770 * @param { AsyncCallback<void> } callback - The callback of terminateSelf. 1771 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1772 * 2. Incorrect parameter types; 3. Parameter verification failed. 1773 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1774 * @throws { BusinessError } 16000004 - Can not start invisible component. 1775 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1776 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1777 * @throws { BusinessError } 16000011 - The context does not exist. 1778 * @throws { BusinessError } 16000050 - Internal error. 1779 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1780 * @systemapi 1781 * @stagemodelonly 1782 * @since 9 1783 */ 1784 /** 1785 * Destroys this service extension. 1786 * 1787 * @param { AsyncCallback<void> } callback - The callback of terminateSelf. 1788 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1789 * 2. Incorrect parameter types; 3. Parameter verification failed. 1790 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1791 * @throws { BusinessError } 16000011 - The context does not exist. 1792 * @throws { BusinessError } 16000050 - Internal error. 1793 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1794 * @systemapi 1795 * @stagemodelonly 1796 * @since 10 1797 */ 1798 terminateSelf(callback: AsyncCallback<void>): void; 1799 1800 /** 1801 * Destroys this service extension. 1802 * 1803 * @returns { Promise<void> } The promise returned by the function. 1804 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1805 * @throws { BusinessError } 16000004 - Can not start invisible component. 1806 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1807 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1808 * @throws { BusinessError } 16000011 - The context does not exist. 1809 * @throws { BusinessError } 16000050 - Internal error. 1810 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1811 * @systemapi 1812 * @stagemodelonly 1813 * @since 9 1814 */ 1815 /** 1816 * Destroys this service extension. 1817 * 1818 * @returns { Promise<void> } The promise returned by the function. 1819 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1820 * @throws { BusinessError } 16000011 - The context does not exist. 1821 * @throws { BusinessError } 16000050 - Internal error. 1822 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1823 * @systemapi 1824 * @stagemodelonly 1825 * @since 10 1826 */ 1827 terminateSelf(): Promise<void>; 1828 1829 /** 1830 * Connects an ability to a Service extension. 1831 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1832 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1833 * service extension when the Service extension is connected.</p> 1834 * 1835 * @param { Want } want - Indicates the service extension to connect. 1836 * @param { ConnectOptions } options - Indicates the callback of connection. 1837 * @returns { number } Returns the connection id. 1838 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1839 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1840 * 2. Incorrect parameter types; 3. Parameter verification failed. 1841 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1842 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1843 * @throws { BusinessError } 16000011 - The context does not exist. 1844 * @throws { BusinessError } 16000050 - Internal error. 1845 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1846 * @systemapi 1847 * @stagemodelonly 1848 * @since 9 1849 */ 1850 /** 1851 * Connects an ability to a service extension ability. 1852 * If the target service extension ability is visible, you can connect the target service extension ability; 1853 * If the target service extension ability is invisible, 1854 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. 1855 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1856 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1857 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1858 * service extension when the Service extension is connected.</p> 1859 * 1860 * @param { Want } want - Indicates the service extension to connect. 1861 * @param { ConnectOptions } options - Indicates the callback of connection. 1862 * @returns { number } Returns the connection id. 1863 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1864 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1865 * 2. Incorrect parameter types; 3. Parameter verification failed. 1866 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1867 * @throws { BusinessError } 16000002 - Incorrect ability type. 1868 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1869 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1870 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1871 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1872 * @throws { BusinessError } 16000011 - The context does not exist. 1873 * @throws { BusinessError } 16000050 - Internal error. 1874 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1875 * @throws { BusinessError } 16000055 - Installation-free timed out. 1876 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1877 * @systemapi 1878 * @stagemodelonly 1879 * @since 10 1880 */ 1881 connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; 1882 1883 /** 1884 * Connects an ability to a Service extension with account. 1885 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1886 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1887 * service extension when the Service extension is connected.</p> 1888 * 1889 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1890 * @param { Want } want - Indicates the service extension to connect. 1891 * @param { number } accountId - Indicates the account to connect. 1892 * @param { ConnectOptions } options - Indicates the callback of connection. 1893 * @returns { number } Returns the connection id. 1894 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1895 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1896 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1897 * 2. Incorrect parameter types; 3. Parameter verification failed. 1898 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1899 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1900 * @throws { BusinessError } 16000011 - The context does not exist. 1901 * @throws { BusinessError } 16000050 - Internal error. 1902 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1903 * @systemapi 1904 * @stagemodelonly 1905 * @since 9 1906 */ 1907 /** 1908 * Connects an ability to a service extension ability with account. 1909 * If the target service extension ability is visible, you can connect the target service extension ability; 1910 * If the target service extension ability is invisible, 1911 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. 1912 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1913 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1914 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1915 * service extension when the Service extension is connected.</p> 1916 * 1917 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1918 * @param { Want } want - Indicates the service extension to connect. 1919 * @param { number } accountId - Indicates the account to connect. 1920 * @param { ConnectOptions } options - Indicates the callback of connection. 1921 * @returns { number } Returns the connection id. 1922 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1923 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1924 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1925 * 2. Incorrect parameter types; 3. Parameter verification failed. 1926 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1927 * @throws { BusinessError } 16000002 - Incorrect ability type. 1928 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1929 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1930 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1931 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1932 * @throws { BusinessError } 16000011 - The context does not exist. 1933 * @throws { BusinessError } 16000050 - Internal error. 1934 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1935 * @throws { BusinessError } 16000055 - Installation-free timed out. 1936 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1937 * @systemapi 1938 * @stagemodelonly 1939 * @since 10 1940 */ 1941 connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; 1942 1943 /** 1944 * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. 1945 * 1946 * @param { number } connection - the connection id returned from connectAbility api. 1947 * @param { AsyncCallback<void> } callback - The callback of disconnectAbility. 1948 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1949 * 2. Incorrect parameter types; 3. Parameter verification failed. 1950 * @throws { BusinessError } 16000011 - The context does not exist. 1951 * @throws { BusinessError } 16000050 - Internal error. 1952 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1953 * @systemapi 1954 * @stagemodelonly 1955 * @since 9 1956 */ 1957 disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void; 1958 1959 /** 1960 * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. 1961 * 1962 * @param { number } connection - the connection id returned from connectAbility api. 1963 * @returns { Promise<void> } The promise returned by the function. 1964 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1965 * 2. Incorrect parameter types; 3. Parameter verification failed. 1966 * @throws { BusinessError } 16000011 - The context does not exist. 1967 * @throws { BusinessError } 16000050 - Internal error. 1968 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1969 * @systemapi 1970 * @stagemodelonly 1971 * @since 9 1972 */ 1973 disconnectServiceExtensionAbility(connection: number): Promise<void>; 1974 1975 /** 1976 * Get the caller object of the startup capability. 1977 * 1978 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 1979 * @param { Want } want - Indicates the ability to start. 1980 * @returns { Promise<Caller> } Returns the Caller interface. 1981 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1982 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1983 * 2. Incorrect parameter types; 3. Parameter verification failed. 1984 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1985 * @throws { BusinessError } 16000002 - Incorrect ability type. 1986 * @throws { BusinessError } 16000004 - Can not start invisible component. 1987 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1988 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1989 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1990 * @throws { BusinessError } 16000011 - The context does not exist. 1991 * @throws { BusinessError } 16000050 - Internal error. 1992 * @throws { BusinessError } 16200001 - The caller has been released. 1993 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1994 * @systemapi 1995 * @stagemodelonly 1996 * @since 9 1997 */ 1998 /** 1999 * Get the caller object of the startup capability. 2000 * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION to use this method. 2001 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2002 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2003 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2004 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2005 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2006 * 2007 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 2008 * @param { Want } want - Indicates the ability to start. 2009 * @returns { Promise<Caller> } Returns the Caller interface. 2010 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2011 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2012 * 2. Incorrect parameter types; 3. Parameter verification failed. 2013 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2014 * @throws { BusinessError } 16000002 - Incorrect ability type. 2015 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2016 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2017 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2018 * @throws { BusinessError } 16000011 - The context does not exist. 2019 * @throws { BusinessError } 16000050 - Internal error. 2020 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2021 * @systemapi 2022 * @stagemodelonly 2023 * @since 10 2024 */ 2025 startAbilityByCall(want: Want): Promise<Caller>; 2026 2027 /** 2028 * Get the caller object that specifies the accountId startup capability 2029 * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 2030 * and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS to use this method. 2031 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2032 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2033 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2034 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2035 * 2036 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 2037 * @param { Want } want - Indicates the ability to start. 2038 * @param { number } accountId - Indicates the account to start. 2039 * @returns { Promise<Caller> } Returns the Caller interface. 2040 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2041 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2042 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2043 * 2. Incorrect parameter types; 3. Parameter verification failed. 2044 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2045 * @throws { BusinessError } 16000002 - Incorrect ability type. 2046 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2047 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2048 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2049 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2050 * @throws { BusinessError } 16000011 - The context does not exist. 2051 * @throws { BusinessError } 16000012 - The application is controlled. 2052 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 2053 * @throws { BusinessError } 16000050 - Internal error. 2054 * @throws { BusinessError } 16200001 - The caller has been released. 2055 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2056 * @systemapi 2057 * @stagemodelonly 2058 * @since 10 2059 */ 2060 startAbilityByCallWithAccount(want: Want, accountId: number): Promise<Caller>; 2061 2062 /** 2063 * Service extension uses this method to start a specific ability, 2064 * if ability is multi instance, will start a recent instance. 2065 * 2066 * @param { Want } want - Indicates the ability to start. 2067 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2068 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2069 * 2. Incorrect parameter types; 3. Parameter verification failed. 2070 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2071 * @throws { BusinessError } 16000002 - Incorrect ability type. 2072 * @throws { BusinessError } 16000004 - Can not start invisible component. 2073 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2074 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2075 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2076 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2077 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 2078 * @throws { BusinessError } 16000011 - The context does not exist. 2079 * @throws { BusinessError } 16000050 - Internal error. 2080 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2081 * @throws { BusinessError } 16000055 - Installation-free timed out. 2082 * @throws { BusinessError } 16200001 - The caller has been released. 2083 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2084 * @systemapi 2085 * @stagemodelonly 2086 * @since 9 2087 */ 2088 /** 2089 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2090 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2091 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2092 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2093 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2094 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2095 * 2096 * @param { Want } want - Indicates the ability to start. 2097 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2098 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2099 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2100 * 2. Incorrect parameter types; 3. Parameter verification failed. 2101 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2102 * @throws { BusinessError } 16000002 - Incorrect ability type. 2103 * @throws { BusinessError } 16000004 - Can not start invisible component. 2104 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2105 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2106 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2107 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2108 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2109 * @throws { BusinessError } 16000011 - The context does not exist. 2110 * @throws { BusinessError } 16000050 - Internal error. 2111 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2112 * @throws { BusinessError } 16000055 - Installation-free timed out. 2113 * @throws { BusinessError } 16200001 - The caller has been released. 2114 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2115 * @systemapi 2116 * @stagemodelonly 2117 * @since 10 2118 */ 2119 /** 2120 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2121 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2122 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2123 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2124 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2125 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2126 * 2127 * @param { Want } want - Indicates the ability to start. 2128 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2129 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2130 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2131 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2132 * 2. Incorrect parameter types; 3. Parameter verification failed. 2133 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2134 * @throws { BusinessError } 16000002 - Incorrect ability type. 2135 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2136 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2137 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2138 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2139 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2140 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2141 * @throws { BusinessError } 16000011 - The context does not exist. 2142 * @throws { BusinessError } 16000050 - Internal error. 2143 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2144 * @throws { BusinessError } 16000055 - Installation-free timed out. 2145 * @throws { BusinessError } 16000071 - App clone is not supported. 2146 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 2147 * @throws { BusinessError } 16000073 - The app clone index is invalid. 2148 * @throws { BusinessError } 16000076 - The app instance key is invalid. 2149 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 2150 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 2151 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 2152 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 2153 * @throws { BusinessError } 16200001 - The caller has been released. 2154 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2155 * @systemapi 2156 * @stagemodelonly 2157 * @since 14 2158 */ 2159 startRecentAbility(want: Want, callback: AsyncCallback<void>): void; 2160 2161 /** 2162 * Service extension uses this method to start a specific ability, 2163 * if ability is multi instance, will start a recent instance. 2164 * 2165 * @param { Want } want - Indicates the ability to start. 2166 * @param { StartOptions } options - Indicates the start options. 2167 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2168 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2169 * 2. Incorrect parameter types; 3. Parameter verification failed. 2170 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2171 * @throws { BusinessError } 16000002 - Incorrect ability type. 2172 * @throws { BusinessError } 16000004 - Can not start invisible component. 2173 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2174 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2175 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2176 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2177 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 2178 * @throws { BusinessError } 16000011 - The context does not exist. 2179 * @throws { BusinessError } 16000050 - Internal error. 2180 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2181 * @throws { BusinessError } 16000055 - Installation-free timed out. 2182 * @throws { BusinessError } 16200001 - The caller has been released. 2183 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2184 * @systemapi 2185 * @stagemodelonly 2186 * @since 9 2187 */ 2188 /** 2189 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2190 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2191 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2192 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2193 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2194 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2195 * 2196 * @param { Want } want - Indicates the ability to start. 2197 * @param { StartOptions } options - Indicates the start options. 2198 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2199 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2200 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2201 * 2. Incorrect parameter types; 3. Parameter verification failed. 2202 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2203 * @throws { BusinessError } 16000004 - Can not start invisible component. 2204 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2205 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2206 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2207 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2208 * @throws { BusinessError } 16000011 - The context does not exist. 2209 * @throws { BusinessError } 16000050 - Internal error. 2210 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2211 * @throws { BusinessError } 16000055 - Installation-free timed out. 2212 * @throws { BusinessError } 16200001 - The caller has been released. 2213 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2214 * @systemapi 2215 * @stagemodelonly 2216 * @since 10 2217 */ 2218 /** 2219 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2220 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2221 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2222 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2223 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2224 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2225 * 2226 * @param { Want } want - Indicates the ability to start. 2227 * @param { StartOptions } options - Indicates the start options. 2228 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2229 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2230 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2231 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2232 * 2. Incorrect parameter types; 3. Parameter verification failed. 2233 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2234 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2235 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2236 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2237 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2238 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2239 * @throws { BusinessError } 16000011 - The context does not exist. 2240 * @throws { BusinessError } 16000050 - Internal error. 2241 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2242 * @throws { BusinessError } 16000055 - Installation-free timed out. 2243 * @throws { BusinessError } 16000071 - App clone is not supported. 2244 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 2245 * @throws { BusinessError } 16000073 - The app clone index is invalid. 2246 * @throws { BusinessError } 16000076 - The app instance key is invalid. 2247 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 2248 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 2249 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 2250 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 2251 * @throws { BusinessError } 16200001 - The caller has been released. 2252 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2253 * @systemapi 2254 * @stagemodelonly 2255 * @since 14 2256 */ 2257 startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 2258 2259 /** 2260 * Service extension uses this method to start a specific ability, 2261 * if ability is multi instance, will start a recent instance. 2262 * 2263 * @param { Want } want - Indicates the ability to start. 2264 * @param { StartOptions } [options] - Indicates the start options. 2265 * @returns { Promise<void> } The promise returned by the function. 2266 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2267 * 2. Incorrect parameter types; 3. Parameter verification failed. 2268 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2269 * @throws { BusinessError } 16000002 - Incorrect ability type. 2270 * @throws { BusinessError } 16000004 - Can not start invisible component. 2271 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2272 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2273 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2274 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2275 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 2276 * @throws { BusinessError } 16000011 - The context does not exist. 2277 * @throws { BusinessError } 16000050 - Internal error. 2278 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2279 * @throws { BusinessError } 16000055 - Installation-free timed out. 2280 * @throws { BusinessError } 16200001 - The caller has been released. 2281 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2282 * @systemapi 2283 * @stagemodelonly 2284 * @since 9 2285 */ 2286 /** 2287 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2288 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2289 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2290 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2291 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2292 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2293 * 2294 * @param { Want } want - Indicates the ability to start. 2295 * @param { StartOptions } [options] - Indicates the start options. 2296 * @returns { Promise<void> } The promise returned by the function. 2297 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2298 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2299 * 2. Incorrect parameter types; 3. Parameter verification failed. 2300 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2301 * @throws { BusinessError } 16000002 - Incorrect ability type. 2302 * @throws { BusinessError } 16000004 - Can not start invisible component. 2303 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2304 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2305 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2306 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2307 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2308 * @throws { BusinessError } 16000011 - The context does not exist. 2309 * @throws { BusinessError } 16000050 - Internal error. 2310 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2311 * @throws { BusinessError } 16000055 - Installation-free timed out. 2312 * @throws { BusinessError } 16200001 - The caller has been released. 2313 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2314 * @systemapi 2315 * @stagemodelonly 2316 * @since 10 2317 */ 2318 /** 2319 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2320 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2321 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2322 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2323 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2324 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2325 * 2326 * @param { Want } want - Indicates the ability to start. 2327 * @param { StartOptions } [options] - Indicates the start options. 2328 * @returns { Promise<void> } The promise returned by the function. 2329 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2330 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2331 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2332 * 2. Incorrect parameter types; 3. Parameter verification failed. 2333 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2334 * @throws { BusinessError } 16000002 - Incorrect ability type. 2335 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2336 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2337 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2338 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2339 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2340 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2341 * @throws { BusinessError } 16000011 - The context does not exist. 2342 * @throws { BusinessError } 16000050 - Internal error. 2343 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2344 * @throws { BusinessError } 16000055 - Installation-free timed out. 2345 * @throws { BusinessError } 16000071 - App clone is not supported. 2346 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 2347 * @throws { BusinessError } 16000073 - The app clone index is invalid. 2348 * @throws { BusinessError } 16000076 - The app instance key is invalid. 2349 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 2350 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 2351 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 2352 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 2353 * @throws { BusinessError } 16200001 - The caller has been released. 2354 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2355 * @systemapi 2356 * @stagemodelonly 2357 * @since 14 2358 */ 2359 startRecentAbility(want: Want, options?: StartOptions): Promise<void>; 2360 2361 /** 2362 * Requests the Modal UIExtensionAbility. 2363 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2364 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2365 * 2366 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2367 * @param { AsyncCallback<void> } callback - The callback of requestModalUIExtension. 2368 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2369 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2370 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2371 * 2. Incorrect parameter types; 3. Parameter verification failed. 2372 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2373 * @throws { BusinessError } 16000002 - Incorrect ability type. 2374 * @throws { BusinessError } 16000004 - Can not start invisible component. 2375 * @throws { BusinessError } 16000050 - Internal error. 2376 * @throws { BusinessError } 16200001 - The caller has been released. 2377 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2378 * @systemapi 2379 * @stagemodelonly 2380 * @since 11 2381 */ 2382 /** 2383 * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground 2384 * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application 2385 * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started 2386 * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, 2387 * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. 2388 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2389 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2390 * 2391 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2392 * @param { AsyncCallback<void> } callback - The callback of requestModalUIExtension. 2393 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2394 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2395 * 2. Incorrect parameter types; 3. Parameter verification failed. 2396 * @throws { BusinessError } 16000050 - Internal error. 2397 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2398 * @systemapi 2399 * @stagemodelonly 2400 * @since 12 2401 */ 2402 requestModalUIExtension(pickerWant: Want, callback: AsyncCallback<void>): void; 2403 2404 /** 2405 * Requests the Modal UIExtensionAbility. 2406 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2407 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2408 * 2409 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2410 * @returns { Promise<void> } The promise returned by the requestModalUIExtension. 2411 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2412 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2413 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2414 * 2. Incorrect parameter types; 3. Parameter verification failed. 2415 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2416 * @throws { BusinessError } 16000002 - Incorrect ability type. 2417 * @throws { BusinessError } 16000004 - Can not start invisible component. 2418 * @throws { BusinessError } 16000050 - Internal error. 2419 * @throws { BusinessError } 16200001 - The caller has been released. 2420 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2421 * @systemapi 2422 * @stagemodelonly 2423 * @since 11 2424 */ 2425 /** 2426 * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground 2427 * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application 2428 * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started 2429 * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, 2430 * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. 2431 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2432 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2433 * 2434 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2435 * @returns { Promise<void> } The promise returned by the requestModalUIExtension. 2436 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2437 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2438 * 2. Incorrect parameter types; 3. Parameter verification failed. 2439 * @throws { BusinessError } 16000050 - Internal error. 2440 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2441 * @systemapi 2442 * @stagemodelonly 2443 * @since 12 2444 */ 2445 requestModalUIExtension(pickerWant: Want): Promise<void>; 2446 2447 /** 2448 * preStartMission opens an atomic service window without popping up a loading window 2449 * 2450 * @permission ohos.permission.PRE_START_ATOMIC_SERVICE 2451 * @param { string } bundleName - The bundle name of the atomic service. 2452 * @param { string } moduleName - The module name of the atomic service. 2453 * @param { string } abilityName - The ability name of the atomic service. 2454 * @param { string } startTime - The start time of the atomic service. 2455 * @returns { Promise<void> } The promise returned by the function. 2456 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2457 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2458 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2459 * 2. Incorrect parameter types; 3. Parameter verification failed. 2460 * @throws { BusinessError } 16300007 - The target free install task does not exist. 2461 * @throws { BusinessError } 16000011 - The context does not exist. 2462 * @throws { BusinessError } 16000050 - Internal error. 2463 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2464 * @systemapi 2465 * @stagemodelonly 2466 * @since 12 2467 */ 2468 preStartMission(bundleName: string, moduleName: string, abilityName: string, startTime: string): Promise<void>; 2469 2470 /** 2471 * Starts a UI service extension ability. 2472 * If the target UI service extension ability is visible, you can start the target UI service extension ability; 2473 * If the target UI service extension ability is invisible, 2474 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UI service extension ability. 2475 * 2476 * @param { Want } want - Indicates the want info to start. 2477 * @returns { Promise<void> } The promise returned by the function. 2478 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2479 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2480 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2481 * 2. Incorrect parameter types; 3. Parameter verification failed. 2482 * @throws { BusinessError } 801 - Capability not supported. 2483 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2484 * @throws { BusinessError } 16000002 - Incorrect ability type. 2485 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2486 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2487 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2488 * @throws { BusinessError } 16000011 - The context does not exist. 2489 * @throws { BusinessError } 16000012 - The application is controlled. 2490 * @throws { BusinessError } 16000013 - The EDM prohibits the application from launching. 2491 * @throws { BusinessError } 16000019 - No matching ability is found. 2492 * @throws { BusinessError } 16000050 - Internal error. 2493 * @throws { BusinessError } 16200001 - The caller has been released. 2494 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2495 * @systemapi 2496 * @stagemodelonly 2497 * @since 14 2498 */ 2499 startUIServiceExtensionAbility(want: Want): Promise<void>; 2500 2501 /** 2502 * Full-screen pop-up startup atomic service. 2503 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2504 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2505 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2506 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2507 * 2508 * @param { string } appId - Globally unique identifier of an application, which is allocated by the cloud. 2509 * @param { AtomicServiceOptions } [options] - Indicates the atomic service start options. 2510 * @returns { Promise<void> } The promise returned by the function. 2511 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2512 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 2513 * @throws { BusinessError } 16000002 - Incorrect ability type. 2514 * @throws { BusinessError } 16000004 - Can not start invisible component 2515 * @throws { BusinessError } 16000011 - The context does not exist. 2516 * @throws { BusinessError } 16000012 - The application is controlled. 2517 * @throws { BusinessError } 16000050 - Internal error. 2518 * @throws { BusinessError } 16200001 - The caller has been released. 2519 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2520 * @systemapi 2521 * @stagemodelonly 2522 * @since 18 2523 */ 2524 openAtomicService(appId: string, options?: AtomicServiceOptions): Promise<void>; 2525} 2526