1e41f4b71Sopenharmony_ci# SysCap (系统能力)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci系统能力(SystemCapability,简称SysCap),指操作系统中每一个相对独立的特性。不同的设备对应不同的系统能力集,每个系统能力对应一个或多个API。开发者可根据系统能力来判断是否可以使用某接口。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## canIUse
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_cicanIUse(syscap: string): boolean
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci查询系统是否具备某个系统能力。
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**参数:**
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 |
22e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
23e41f4b71Sopenharmony_ci| syscap | string | 是 | 待查询的系统能力名称。 |
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**返回值:**
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci| 类型 | 说明 |
28e41f4b71Sopenharmony_ci| -------- | -------- |
29e41f4b71Sopenharmony_ci| boolean | 系统能力查询结果,true表示系统具备该能力,false表示系统不具备。 |
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci**示例:**
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci  ```js
34e41f4b71Sopenharmony_ciimport { geoLocationManager } from '@kit.LocationKit'
35e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciconst isLocationAvailable = canIUse('SystemCapability.Location.Location.Core');
38e41f4b71Sopenharmony_ciif (isLocationAvailable) {
39e41f4b71Sopenharmony_ci    geoLocationManager.getCurrentLocation((err: BusinessError, location: geoLocationManager.Location) => {
40e41f4b71Sopenharmony_ci        if (err) {
41e41f4b71Sopenharmony_ci            console.error('err=' + JSON.stringify(err));
42e41f4b71Sopenharmony_ci        }
43e41f4b71Sopenharmony_ci        if (location) {
44e41f4b71Sopenharmony_ci            console.log('location=' + JSON.stringify(location));
45e41f4b71Sopenharmony_ci        }
46e41f4b71Sopenharmony_ci    });
47e41f4b71Sopenharmony_ci} else {
48e41f4b71Sopenharmony_ci    console.log('Location not by this device.');
49e41f4b71Sopenharmony_ci}
50e41f4b71Sopenharmony_ci  ```