1e41f4b71Sopenharmony_ci# (Optional) Using canOpenLink to Check Application Accessibility
2e41f4b71Sopenharmony_ci## When to Use
3e41f4b71Sopenharmony_ciBefore starting application B, application A can call **canOpenLink** to check whether application B is accessible.
4e41f4b71Sopenharmony_ci## Constraints
5e41f4b71Sopenharmony_ciA maximum of 50 URL schemes can be configured in the [querySchemes](../quick-start/module-configuration-file.md) field in the **module.json5** file of the entry module.
6e41f4b71Sopenharmony_ci## Available APIs
7e41f4b71Sopenharmony_ci**canOpenLink** is provided by the [bundleManager](../reference/apis-ability-kit/js-apis-bundleManager.md#bundlemanagercanopenlink12) module to check whether a target application is accessible.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciFor details about the matching rules, see [Matching Rules of Explicit Want and Implicit Want](explicit-implicit-want-mappings.md).
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## How to Develop
12e41f4b71Sopenharmony_ci### Procedure for the Caller Application
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci1. Configure the [querySchemes](../quick-start/module-configuration-file.md) field in the **module.json5** file of the entry module to declare the URL schemes.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci    A configuration example is as follows:
17e41f4b71Sopenharmony_ci    ```json
18e41f4b71Sopenharmony_ci    {
19e41f4b71Sopenharmony_ci      "module": {
20e41f4b71Sopenharmony_ci        //...
21e41f4b71Sopenharmony_ci        "querySchemes": [
22e41f4b71Sopenharmony_ci          "app1Scheme"
23e41f4b71Sopenharmony_ci        ]
24e41f4b71Sopenharmony_ci      }
25e41f4b71Sopenharmony_ci    }
26e41f4b71Sopenharmony_ci    ```
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci2. Import the **ohos.bundle.bundleManager** module.
29e41f4b71Sopenharmony_ci3. Call **canOpenLink**.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci    The sample code is as follows:
32e41f4b71Sopenharmony_ci    ```ts
33e41f4b71Sopenharmony_ci    import { bundleManager } from '@kit.AbilityKit';
34e41f4b71Sopenharmony_ci    import { BusinessError } from '@kit.BasicServicesKit';
35e41f4b71Sopenharmony_ci    import { hilog } from '@kit.PerformanceAnalysisKit';
36e41f4b71Sopenharmony_ci    try {
37e41f4b71Sopenharmony_ci      let link = 'app1Scheme://test.example.com/home';
38e41f4b71Sopenharmony_ci      let canOpen = bundleManager.canOpenLink(link);
39e41f4b71Sopenharmony_ci      hilog.info(0x0000, 'testTag', 'canOpenLink successfully: %{public}s', JSON.stringify(canOpen));
40e41f4b71Sopenharmony_ci    } catch (err) {
41e41f4b71Sopenharmony_ci      let message = (err as BusinessError).message;
42e41f4b71Sopenharmony_ci      hilog.error(0x0000, 'testTag', 'canOpenLink failed: %{public}s', message);
43e41f4b71Sopenharmony_ci    }
44e41f4b71Sopenharmony_ci    ```
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci### Procedure for the Target Application
47e41f4b71Sopenharmony_ciConfigure the [uris](../quick-start/module-configuration-file.md#skills) field in the **module.json5** file.
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ciA configuration example is as follows:
50e41f4b71Sopenharmony_ci```json
51e41f4b71Sopenharmony_ci{
52e41f4b71Sopenharmony_ci  "module": {
53e41f4b71Sopenharmony_ci    //...
54e41f4b71Sopenharmony_ci    "abilities": [
55e41f4b71Sopenharmony_ci      {
56e41f4b71Sopenharmony_ci        //...
57e41f4b71Sopenharmony_ci        "skills": [
58e41f4b71Sopenharmony_ci          {
59e41f4b71Sopenharmony_ci            "uris": [
60e41f4b71Sopenharmony_ci              {
61e41f4b71Sopenharmony_ci                "scheme": "app1Scheme",
62e41f4b71Sopenharmony_ci                "host": "test.example.com",
63e41f4b71Sopenharmony_ci                "pathStartWith": "home"
64e41f4b71Sopenharmony_ci              }
65e41f4b71Sopenharmony_ci            ]
66e41f4b71Sopenharmony_ci          }
67e41f4b71Sopenharmony_ci        ]
68e41f4b71Sopenharmony_ci      }
69e41f4b71Sopenharmony_ci    ]
70e41f4b71Sopenharmony_ci  } 
71e41f4b71Sopenharmony_ci}
72e41f4b71Sopenharmony_ci```
73