• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 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 LocationKit
19 */
20
21import ExtensionContext from './application/ExtensionContext';
22import type Want from './@ohos.app.ability.Want';
23
24/**
25 * class of static subscriber extension context.
26 *
27 * @extends ExtensionContext
28 * @syscap SystemCapability.Location.Location.Geofence
29 * @stagemodelonly
30 * @since 14
31 */
32export default class FenceExtensionContext extends ExtensionContext {
33  /**
34   * Starts a new service extension ability.
35   * If the target service extension ability is visible, you can start the target service extension ability;
36   * If the target service extension ability is invisible,
37   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
38   * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
39   *
40   * @param { Want } want - Indicates the want info to start.
41   * @returns { Promise<void> } The promise returned by the function.
42   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
43   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
44   * @throws { BusinessError } 16000001 - The specified ability does not exist.
45   * @throws { BusinessError } 16000002 - Incorrect ability type.
46   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
47   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
48   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
49   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
50   * @throws { BusinessError } 16000011 - The context does not exist.
51   * @throws { BusinessError } 16000012 - The application is controlled.
52   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
53   * @throws { BusinessError } 16000019 - No matching ability is found.
54   * @throws { BusinessError } 16000050 - Internal error.
55   * @throws { BusinessError } 16200001 - The caller has been released.
56   * @syscap SystemCapability.Location.Location.Geofence
57   * @systemapi
58   * @stagemodelonly
59   * @since 14
60   */
61  startAbility(want: Want): Promise<void>;
62}
63