1e41f4b71Sopenharmony_ci# @ohos.geoLocationManager (Geolocation Manager)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **geoLocationManager** module provides basic location services such as Global Navigation Satellite System (GNSS)-based positioning, network positioning (for example, base station positioning or WLAN/Bluetooth positioning), geofencing, as well as geocoding and reverse geocoding.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci> This module supports only the WGS-84 coordinate system.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Applying for Permissions
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciFor details, see [Applying for Location Permissions](../../device/location/location-guidelines.md#applying-for-location-permissions).
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Modules to Import
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci```ts
18e41f4b71Sopenharmony_ciimport { geoLocationManager } from '@kit.LocationKit';
19e41f4b71Sopenharmony_ci```
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci## ReverseGeoCodeRequest
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ciDefines a reverse geocoding request.
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
29e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
30e41f4b71Sopenharmony_ci| locale | string | No| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English. The default language is obtained from **Language and region** in **Settings**.|
31e41f4b71Sopenharmony_ci| country<sup>12+</sup> | string | No| Yes| Country information. The country code complies with the ISO 3166-1 alpha-2 standard. **CN** indicates China. The default language is obtained from **Language and region** in **Settings**.|
32e41f4b71Sopenharmony_ci| latitude | number | No| No| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from **-90** to **90**. Only the WGS84 coordinate system is supported.|
33e41f4b71Sopenharmony_ci| longitude | number | No| No| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from **-180** to **180**. Only the WGS84 coordinate system is supported.|
34e41f4b71Sopenharmony_ci| maxItems | number | No| Yes| Maximum number of location records to be returned. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended. The default value is **1**.|
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci## GeoCodeRequest
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciDefines a reverse geocoding request.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
44e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
45e41f4b71Sopenharmony_ci| locale | string | No| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English. The default language is obtained from **Language and region** in **Settings**.|
46e41f4b71Sopenharmony_ci| country<sup>12+</sup> | string | No| Yes| Country information. The country code complies with the ISO 3166-1 alpha-2 standard. **CN** indicates China. The default language is obtained from **Language and region** in **Settings**.|
47e41f4b71Sopenharmony_ci| description | string | No| No| Location description, for example, **No. xx, xx Road, Pudong New District, Shanghai**.|
48e41f4b71Sopenharmony_ci| maxItems | number | No| Yes| Maximum number of location records to be returned. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended. The default value is **1**.|
49e41f4b71Sopenharmony_ci| minLatitude | number | No| Yes| Minimum latitude. This parameter is used with **minLongitude**, **maxLatitude**, and **maxLongitude** to specify the latitude and longitude ranges. The value ranges from **-90** to **90**. Only the WGS84 coordinate system is supported. The following three parameters are mandatory is this parameter is specified.|
50e41f4b71Sopenharmony_ci| minLongitude | number | No| Yes| Minimum longitude. The value ranges from **-180** to **180**. Only the WGS84 coordinate system is supported.|
51e41f4b71Sopenharmony_ci| maxLatitude | number | No| Yes| Maximum latitude. The value ranges from **-90** to **90**. Only the WGS84 coordinate system is supported.|
52e41f4b71Sopenharmony_ci| maxLongitude | number | No| Yes| Maximum longitude. The value ranges from **-180** to **180**. Only the WGS84 coordinate system is supported.|
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci## GeoAddress
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ciGeocoding address information.
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
62e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
63e41f4b71Sopenharmony_ci| latitude | number | No| Yes | Latitude information. A positive value indicates a north latitude, and a negative value indicates a south latitude. The value ranges from **-90** to **90**. Only the WGS84 coordinate system is supported.|
64e41f4b71Sopenharmony_ci| longitude | number | No| Yes | Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from **-180** to **180**. Only the WGS84 coordinate system is supported.|
65e41f4b71Sopenharmony_ci| locale | string | No| Yes | Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
66e41f4b71Sopenharmony_ci| placeName | string | No| Yes | Address information.|
67e41f4b71Sopenharmony_ci| countryCode | string | No| Yes | Country code.|
68e41f4b71Sopenharmony_ci| countryName | string | No| Yes| Country name.|
69e41f4b71Sopenharmony_ci| administrativeArea | string | No| Yes| Level-1 administrative region, which is generally is a province or state.|
70e41f4b71Sopenharmony_ci| subAdministrativeArea | string | No| Yes| Level-2 administrative region, which is generally is a city.|
71e41f4b71Sopenharmony_ci| locality | string | No| Yes| Locality information, which is usually a city.|
72e41f4b71Sopenharmony_ci| subLocality | string | No| Yes| Sub-locality information, which is usually a district or county.|
73e41f4b71Sopenharmony_ci| roadName | string | No| Yes| Road name.|
74e41f4b71Sopenharmony_ci| subRoadName | string | No| Yes| Auxiliary road information.|
75e41f4b71Sopenharmony_ci| premises | string | No| Yes| House information.|
76e41f4b71Sopenharmony_ci| postalCode | string | No| Yes| Postal code.|
77e41f4b71Sopenharmony_ci| phoneNumber | string | No| Yes| Phone number.|
78e41f4b71Sopenharmony_ci| addressUrl | string | No| Yes| Website URL.|
79e41f4b71Sopenharmony_ci| descriptions | Array&lt;string&gt; | No| Yes| Additional description. It contains **cityCode** (the array subscript is **0**) and **adminCode** (the array subscript is **1**), for example, **["025","320114001"]**.|
80e41f4b71Sopenharmony_ci| descriptionsSize | number | No| Yes| Total number of additional descriptions. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci## LocationRequest
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ciDefines a location request.
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
92e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
93e41f4b71Sopenharmony_ci| priority | [LocationRequestPriority](#locationrequestpriority) | No| Yes| Priority of the location request. This parameter is effective only when **scenario** is set to **UNSET**. If this parameter and **scenario** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
94e41f4b71Sopenharmony_ci| scenario | [LocationRequestScenario](#locationrequestscenario) | No| Yes| Scenario of the location request. The **priority** parameter is effective only when this parameter is set to **UNSET**. If this parameter and **priority** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
95e41f4b71Sopenharmony_ci| timeInterval | number | No| Yes| Time interval at which location information is reported, in seconds. The specified value must be greater than or equal to **0**. The default value is **1**. If this parameter is set to **0**, there is no restriction on the location reporting interval.|
96e41f4b71Sopenharmony_ci| distanceInterval | number | No| Yes| Distance interval at which location information is reported, in meters. The specified value must be greater than or equal to **0**. The default value is **0**. If this parameter is set to **0**, there is no restriction on the location reporting distance.|
97e41f4b71Sopenharmony_ci| maxAccuracy | number | No| Yes|  Location accuracy, in meters.<br>This parameter is valid only when the precise location function is enabled (both the ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION permissions are granted). This parameter is valid only when the precise location function is enabled (both the **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION** permissions are granted), and is invalid when the approximate location function is enabled (only the **ohos.permission.APPROXIMATELY_LOCATION** permission is enabled).<br>The specified value must be greater than or equal to **0**. The default value is **0**.<br>If **scenario** is set to **NAVIGATION**, **TRAJECTORY_TRACKING**, or **CAR_HAILING** or **priority** is set to **ACCURACY**, you are advised to set **maxAccuracy** to a value greater than **10**.<br>If scenario is set to **DAILY_LIFE_SERVICE** or **NO_POWER** or **priority** is set to **LOW_POWER** or **FIRST_FIX**, you are advised to set **maxAccuracy** to a value greater than **100**.|
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci## CurrentLocationRequest
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ciDefines a location request.
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
109e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
110e41f4b71Sopenharmony_ci| priority | [LocationRequestPriority](#locationrequestpriority) | No| Yes| Priority of the location request. This parameter is effective only when **scenario** is set to **UNSET**. If this parameter and **scenario** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
111e41f4b71Sopenharmony_ci| scenario | [LocationRequestScenario](#locationrequestscenario) | No| Yes| Scenario of the location request. The **priority** parameter is effective only when this parameter is set to **UNSET**. If this parameter and **priority** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
112e41f4b71Sopenharmony_ci| maxAccuracy | number | No| Yes|  Location accuracy, in meters.<br>This parameter is valid only when the precise location function is enabled (both the ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION permissions are granted). This parameter is valid only when the precise location function is enabled (both the **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION** permissions are granted), and is invalid when the approximate location function is enabled (only the **ohos.permission.APPROXIMATELY_LOCATION** permission is enabled).<br>The specified value must be greater than or equal to **0**. The default value is **0**.<br>If **scenario** is set to **NAVIGATION**, **TRAJECTORY_TRACKING**, or **CAR_HAILING** or **priority** is set to **ACCURACY**, you are advised to set **maxAccuracy** to a value greater than **10**.<br>If scenario is set to **DAILY_LIFE_SERVICE** or **NO_POWER** or **priority** is set to **LOW_POWER** or **FIRST_FIX**, you are advised to set **maxAccuracy** to a value greater than **100**.|
113e41f4b71Sopenharmony_ci| timeoutMs | number | No| Yes| Timeout duration, in milliseconds. The minimum value is **1000**. The specified value must be greater than or equal to **1000**.|
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci## ContinuousLocationRequest<sup>12+</sup>
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ciDefines a continuous location request.
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
125e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
126e41f4b71Sopenharmony_ci| interval | number | No| No| Time interval at which location information is reported, in seconds. The specified value must be greater than or equal to **0**. The default value is **1**. If this parameter is set to **0**, there is no restriction on the location reporting interval.|
127e41f4b71Sopenharmony_ci| locationScenario | [UserActivityScenario](#useractivityscenario12) &#124; [PowerConsumptionScenario](#powerconsumptionscenario12) | No| No| Location scenario. For details, see [UserActivityScenario](#useractivityscenario12) and [PowerConsumptionScenario](#powerconsumptionscenario12).|
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci## SingleLocationRequest<sup>12+</sup>
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ciDefines a single location request.
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
139e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
140e41f4b71Sopenharmony_ci| locatingPriority | [LocatingPriority](#locatingpriority12) | No| No| Priority of the location request. For details, see [LocatingPriority](#locatingpriority12).|
141e41f4b71Sopenharmony_ci| locatingTimeoutMs | number | No| No| Timeout duration, in milliseconds. The minimum value is **1000**. The specified value must be greater than or equal to **1000**.|
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ci## SatelliteStatusInfo
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ciDefines the satellite status information.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
151e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
152e41f4b71Sopenharmony_ci| satellitesNumber | number | No| No| Number of satellites. The specified value must be greater than or equal to **0**.|
153e41f4b71Sopenharmony_ci| satelliteIds | Array&lt;number&gt; | No| No| Array of satellite IDs. The specified value must be greater than or equal to **0**.|
154e41f4b71Sopenharmony_ci| carrierToNoiseDensitys | Array&lt;number&gt; | No| No| Carrier-to-noise density ratio, that is, **cn0**. The specified value must be greater than **0**.|
155e41f4b71Sopenharmony_ci| altitudes | Array&lt;number&gt; | No| No| Satellite altitude angle information. The value ranges from **-90** to **90**, in degrees.|
156e41f4b71Sopenharmony_ci| azimuths | Array&lt;number&gt; | No| No| Azimuth information. The value ranges from **0** to **360**, in degrees.|
157e41f4b71Sopenharmony_ci| carrierFrequencies | Array&lt;number&gt; | No| No| Carrier frequency, in Hz. The specified value must be greater than or equal to **0**.|
158e41f4b71Sopenharmony_ci| satelliteConstellation<sup>12+</sup> | Array&lt;[SatelliteConstellationCategory](#satelliteconstellationcategory12)&gt; | No| Yes| Satellite constellation type.|
159e41f4b71Sopenharmony_ci| satelliteAdditionalInfo<sup>12+</sup> | Array&lt;number&gt; | No| Yes| Additional satellite information.<br>Each bit has a different meaning. For details, see [SatelliteAdditionalInfo](#satelliteadditionalinfo12).|
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci## CachedGnssLocationsRequest
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ciDefines a request for reporting cached GNSS locations.
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
169e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
170e41f4b71Sopenharmony_ci| reportingPeriodSec | number | No| No| Interval for reporting the cached GNSS locations, in milliseconds. The specified value must be greater than **0**.|
171e41f4b71Sopenharmony_ci| wakeUpCacheQueueFull | boolean | No| No | **true**: reports the cached GNSS locations to the application when the cache queue is full.<br>**false**: discards the cached GNSS locations when the cache queue is full.|
172e41f4b71Sopenharmony_ci
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci## Geofence
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ciDefines a GNSS geofence. Currently, only circular geofences are supported.
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
181e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
182e41f4b71Sopenharmony_ci| latitude | number | No| No|Latitude information. The value ranges from **-90** to **90**.|
183e41f4b71Sopenharmony_ci| longitude | number | No|No| Longitude information. The value ranges from **-180** to **180**.|
184e41f4b71Sopenharmony_ci| coordinateSystemType<sup>12+</sup> | [CoordinateSystemType](#coordinatesystemtype12) | No|Yes| Coordinate system of the circle center of a geofence.<br>The application needs to call [getGeofenceSupportedCoordTypes](#geolocationmanagergetgeofencesupportedcoordtypes12) to query the supported coordinate systems and then pass in the correct coordinates of the circle center.|
185e41f4b71Sopenharmony_ci| radius | number | No|No| Radius of a circular geofence, in meters. The specified value must be greater than **0**.|
186e41f4b71Sopenharmony_ci| expiration | number | No|No| Expiration period of a geofence, in milliseconds. The specified value must be greater than **0**.|
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci## GeofenceRequest
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ciDefines a geofence request.
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
196e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
197e41f4b71Sopenharmony_ci| scenario | [LocationRequestScenario](#locationrequestscenario) | No| No |  Location scenario.|
198e41f4b71Sopenharmony_ci| geofence |  [Geofence](#geofence)| No| No |  Geofence information.|
199e41f4b71Sopenharmony_ci
200e41f4b71Sopenharmony_ci
201e41f4b71Sopenharmony_ci## LocationCommand
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ciDefines a location command.
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
208e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
209e41f4b71Sopenharmony_ci| scenario | [LocationRequestScenario](#locationrequestscenario)  | No| No | Location scenario.|
210e41f4b71Sopenharmony_ci| command | string | No| No | Extended command, in the string format.|
211e41f4b71Sopenharmony_ci
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ci## Location
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ciLocation information.
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
220e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
221e41f4b71Sopenharmony_ci| latitude | number| No| No| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from **-90** to **90**. Only the WGS84 coordinate system is supported.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
222e41f4b71Sopenharmony_ci| longitude | number| No| No| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from **-180** to **180**. Only the WGS84 coordinate system is supported.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
223e41f4b71Sopenharmony_ci| altitude | number | No| No| Location altitude, in meters.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
224e41f4b71Sopenharmony_ci| accuracy | number | No| No| Location accuracy, in meters.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
225e41f4b71Sopenharmony_ci| speed | number | No| No|Speed, in m/s.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
226e41f4b71Sopenharmony_ci| timeStamp | number | No| No| Location timestamp in the UTC format.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
227e41f4b71Sopenharmony_ci| direction | number | No| No| Direction information. The value ranges from **0** to **360**, in degrees.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
228e41f4b71Sopenharmony_ci| timeSinceBoot | number | No| No| Location timestamp since boot.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
229e41f4b71Sopenharmony_ci| additions | Array&lt;string&gt;| No| Yes| Additional description.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
230e41f4b71Sopenharmony_ci| additionSize | number| No| Yes| Number of additional descriptions. The specified value must be greater than or equal to **0**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
231e41f4b71Sopenharmony_ci| additionsMap<sup>12+</sup> | Map&lt;string, string&gt;| No| Yes| Additional description. The content and sequence are the same as those of **additions**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
232e41f4b71Sopenharmony_ci| altitudeAccuracy<sup>12+</sup> |number | No| Yes| Height accuracy, in meters.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
233e41f4b71Sopenharmony_ci| speedAccuracy<sup>12+</sup> | number| No| Yes| Speed accuracy, in meters per second.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
234e41f4b71Sopenharmony_ci| directionAccuracy<sup>12+</sup> | number| No| Yes| Direction accuracy. The value ranges from **0** to **360**, in degrees.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
235e41f4b71Sopenharmony_ci| uncertaintyOfTimeSinceBoot<sup>12+</sup> | number| No| Yes| Uncertainty of the location timestamp.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
236e41f4b71Sopenharmony_ci| sourceType<sup>12+</sup> | [LocationSourceType](#locationsourcetype12) | No| Yes| Source of the location result.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci## GeofenceTransition<sup>12+</sup>
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ciDefines a geofence transition event.
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
246e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
247e41f4b71Sopenharmony_ci| geofenceId | number| No| No| Geofence ID.|
248e41f4b71Sopenharmony_ci| transitionEvent | [GeofenceTransitionEvent](#geofencetransitionevent12) | No| No| Geofence transition event.|
249e41f4b71Sopenharmony_ci
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci## GnssGeofenceRequest<sup>12+</sup>
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_ciDefines a GNSS geofence request.
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
258e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
259e41f4b71Sopenharmony_ci| geofence | [Geofence](#geofence) | No| No| Geofence information, including the coordinates and radius of the circle center.|
260e41f4b71Sopenharmony_ci| monitorTransitionEvents | Array&lt;[GeofenceTransitionEvent](#geofencetransitionevent12)&gt; | No| No| List of geofence transition events.|
261e41f4b71Sopenharmony_ci| notifications | Array&lt;[NotificationRequest](../apis-notification-kit/js-apis-notification.md#notificationrequest)&gt; | No| Yes| List of notifications for geofence transition events.<br>The sequence of **monitorTransitionEvents** must correspond to that of **notifications**. For example, if **monitorTransitionEvents[0]** is **[GeofenceTransitionEvent](#geofencetransitionevent12).GEOFENCE_TRANSITION_EVENT_ENTER**, **notifications[0]** must be set to the notification that needs to be displayed when a user enters the geofence.|
262e41f4b71Sopenharmony_ci| geofenceTransitionCallback | AsyncCallback&lt;[GeofenceTransition](#geofencetransition12)&gt; | No| No| Callback used to receive geofence transition events.|
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci## CountryCode
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ciDefines the country code information.
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
272e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
273e41f4b71Sopenharmony_ci| country | string | No| No| Country code.|
274e41f4b71Sopenharmony_ci| type |  [CountryCodeType](#countrycodetype) | No| No| Country code source.|
275e41f4b71Sopenharmony_ci
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci## LocationRequestPriority
278e41f4b71Sopenharmony_ci
279e41f4b71Sopenharmony_ciSets the priority of a location request.
280e41f4b71Sopenharmony_ci
281e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
282e41f4b71Sopenharmony_ci
283e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
284e41f4b71Sopenharmony_ci
285e41f4b71Sopenharmony_ci| Name| Value| Description|
286e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
287e41f4b71Sopenharmony_ci| UNSET | 0x200 | Priority unspecified.<br>If this option is used, [LocationRequestPriority](#locationrequestpriority) is invalid.|
288e41f4b71Sopenharmony_ci| ACCURACY | 0x201 | Location accuracy.<br>The location accuracy priority mainly uses the GNSS positioning technology. The system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. During the continuous location process, the network positioning technology is used if the GNSS location result cannot be obtained within 30 seconds. This policy can lead to significant hardware resource consumption and power consumption.|
289e41f4b71Sopenharmony_ci| LOW_POWER | 0x202 | Power efficiency.<br>This policy uses only the network positioning technology to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption if a high location accuracy is not required.|
290e41f4b71Sopenharmony_ci| FIRST_FIX | 0x203 | Fast location preferred. Use this option if you want to obtain a location as fast as possible.<br>This policy uses the GNSS positioning and network positioning technologies simultaneously to obtain the device location in both the indoor and outdoor scenarios. When all positioning technologies provide a location result, the system provides the most accurate location result for your application. It can lead to significant hardware resource consumption and power consumption.|
291e41f4b71Sopenharmony_ci
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ci## LocationRequestScenario
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ciDefines the location scenario in a location request.
296e41f4b71Sopenharmony_ci
297e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci> **NOTE**
302e41f4b71Sopenharmony_ci>
303e41f4b71Sopenharmony_ci> If a single location or continuous location is initiated in the NAVIGATION, TRAJECTORY_TRACKING, or CAR_HAILING scenario, the system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. During the continuous location process, the network positioning technology is used if the GNSS location result cannot be obtained within 30 seconds.
304e41f4b71Sopenharmony_ci
305e41f4b71Sopenharmony_ci| Name| Value| Description|
306e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
307e41f4b71Sopenharmony_ci| UNSET | 0x300 | Scenario unspecified.<br>If this option is used, [LocationRequestScenario](#locationrequestscenario) is invalid.|
308e41f4b71Sopenharmony_ci| NAVIGATION | 0x301 | Navigation.<br>This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking.<br>This option mainly uses the GNSS positioning technology and therefore the power consumption is relatively high.|
309e41f4b71Sopenharmony_ci| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking.<br>This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications.<br>It mainly uses the GNSS positioning technology and therefore the power consumption is relatively high.|
310e41f4b71Sopenharmony_ci| CAR_HAILING | 0x303 | Ride hailing.<br>This option is applicable when your application needs to obtain the current location of a user who is hailing a taxi.<br>It mainly uses the GNSS positioning technology and therefore the power consumption is relatively high.|
311e41f4b71Sopenharmony_ci| DAILY_LIFE_SERVICE | 0x304 | Daily life services.<br>This option is applicable when your application only needs the approximate location in scenarios such as when the user is browsing news, shopping online, and ordering food.<br>It mainly uses the network positioning technology and therefore the power consumption is relatively low.|
312e41f4b71Sopenharmony_ci| NO_POWER | 0x305 | Power efficiency. Your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.|
313e41f4b71Sopenharmony_ci
314e41f4b71Sopenharmony_ci
315e41f4b71Sopenharmony_ci## CountryCodeType
316e41f4b71Sopenharmony_ci
317e41f4b71Sopenharmony_ciDefines the country code source type.
318e41f4b71Sopenharmony_ci
319e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
320e41f4b71Sopenharmony_ci
321e41f4b71Sopenharmony_ci| Name| Value| Description|
322e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
323e41f4b71Sopenharmony_ci| COUNTRY_CODE_FROM_LOCALE | 1 | Country code obtained from the language configuration of the globalization module.|
324e41f4b71Sopenharmony_ci| COUNTRY_CODE_FROM_SIM | 2 | Country code obtained from the SIM card.|
325e41f4b71Sopenharmony_ci| COUNTRY_CODE_FROM_LOCATION | 3 | Country code obtained using the reverse geocoding function based on the user's location information.|
326e41f4b71Sopenharmony_ci| COUNTRY_CODE_FROM_NETWORK | 4 | Country code obtained from the cellular network registration information.|
327e41f4b71Sopenharmony_ci
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ci## CoordinateSystemType<sup>12+</sup>
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ciEnumerates coordinate system types.
332e41f4b71Sopenharmony_ci
333e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
334e41f4b71Sopenharmony_ci
335e41f4b71Sopenharmony_ci| Name| Value| Description|
336e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
337e41f4b71Sopenharmony_ci| WGS84 | 1 | World Geodetic System 1984, a coordinate system established for the use of the GPS.|
338e41f4b71Sopenharmony_ci| GCJ02 | 2 | GCJ-02, a coordinate system for the geographic information system developed by the State Bureau of Surveying and Mapping of China.|
339e41f4b71Sopenharmony_ci
340e41f4b71Sopenharmony_ci
341e41f4b71Sopenharmony_ci## GeofenceTransitionEvent<sup>12+</sup>
342e41f4b71Sopenharmony_ci
343e41f4b71Sopenharmony_ciDefines a geofence transition event.
344e41f4b71Sopenharmony_ci
345e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
346e41f4b71Sopenharmony_ci
347e41f4b71Sopenharmony_ci| Name| Value| Description|
348e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
349e41f4b71Sopenharmony_ci| GEOFENCE_TRANSITION_EVENT_ENTER  | 1 | Event indicating that a device moves into a geofence.|
350e41f4b71Sopenharmony_ci| GEOFENCE_TRANSITION_EVENT_EXIT  | 2 | Event indicating that a device moves out of a geofence.|
351e41f4b71Sopenharmony_ci| GEOFENCE_TRANSITION_EVENT_DWELL   | 4 | Event indicating that a device stays in a geofence for more than 10s.|
352e41f4b71Sopenharmony_ci
353e41f4b71Sopenharmony_ci
354e41f4b71Sopenharmony_ci## SatelliteConstellationCategory<sup>12+</sup>
355e41f4b71Sopenharmony_ci
356e41f4b71Sopenharmony_ciEnumerates satellite constellation types.
357e41f4b71Sopenharmony_ci
358e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
359e41f4b71Sopenharmony_ci
360e41f4b71Sopenharmony_ci| Name| Value| Description|
361e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
362e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_UNKNOWN   | 0 | Unknown type. This is the default value.|
363e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_GPS   | 1 | Global positioning system (GPS), a high-precision radio navigation positioning system made up of artificial earth satellites launched by the United States.|
364e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_SBAS    | 2 | Satellite-based augmentation system (SBAS), which supports wide-area or regional augmentation through the use of geostationary (GEO) satellites for broadcasting augmentation information, such as ephemeris error, satellite clock difference, and ionospheric delay, to users. It enhances the accuracy, integrity, and availability of basic global navigation satellite systems.|
365e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_GLONASS    | 3 | Global navigation satellite system (GLONASS), a Russia space-based satellite navigation system that provides a global coverage positioning service similar to the GPS.|
366e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_QZSS    | 4 | Quasi-Zenith satellite system (QZSS), a regional navigation satellite system developed by Japan to enhance and augment GPS coverage over Japan's territory.|
367e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_BEIDOU     | 5 | Beidou navigation satellite system (BNSS), a global satellite navigation system developed by China.|
368e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_GALILEO     | 6 | Galileo satellite navigation system (GALILEO), a global satellite navigation and positioning system developed and established by the European Union.|
369e41f4b71Sopenharmony_ci| CONSTELLATION_CATEGORY_IRNSS     | 7 | Indian regional navigation satellite system (IRNSS), an independent regional satellite navigation system developed and operated by India.|
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci
372e41f4b71Sopenharmony_ci## SatelliteAdditionalInfo<sup>12+</sup>
373e41f4b71Sopenharmony_ci
374e41f4b71Sopenharmony_ciEnumerates the types of additional satellite information.
375e41f4b71Sopenharmony_ci
376e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
377e41f4b71Sopenharmony_ci
378e41f4b71Sopenharmony_ci| Name| Value| Description|
379e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
380e41f4b71Sopenharmony_ci| SATELLITES_ADDITIONAL_INFO_NULL  | 0 | No additional information. This is the default value.|
381e41f4b71Sopenharmony_ci| SATELLITES_ADDITIONAL_INFO_EPHEMERIS_DATA_EXIST  | 1 | Ephemeris data.|
382e41f4b71Sopenharmony_ci| SATELLITES_ADDITIONAL_INFO_ALMANAC_DATA_EXIST   | 2 | Almanac data.|
383e41f4b71Sopenharmony_ci| SATELLITES_ADDITIONAL_INFO_USED_IN_FIX   | 4 | Use of the satellite in the latest location resolution.|
384e41f4b71Sopenharmony_ci| SATELLITES_ADDITIONAL_INFO_CARRIER_FREQUENCY_EXIST   | 8 | Presence of carrier frequencies on the satellite.|
385e41f4b71Sopenharmony_ci
386e41f4b71Sopenharmony_ci
387e41f4b71Sopenharmony_ci## PowerConsumptionScenario<sup>12+</sup>
388e41f4b71Sopenharmony_ci
389e41f4b71Sopenharmony_ciEnumerates power consumption scenarios in a location request.
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
392e41f4b71Sopenharmony_ci
393e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
394e41f4b71Sopenharmony_ci
395e41f4b71Sopenharmony_ci| Name| Value| Description|
396e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
397e41f4b71Sopenharmony_ci| HIGH_POWER_CONSUMPTION  | 0x601 | High power consumption.<br>The mode mainly uses the GNSS positioning technology. The system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. During the continuous location process, the network positioning technology is used if the GNSS location result cannot be obtained within 30 seconds. This policy can lead to significant hardware resource consumption and power consumption.|
398e41f4b71Sopenharmony_ci| LOW_POWER_CONSUMPTION  | 0x602 | Low power consumption.<br>This mode is applicable when your application only needs the approximate location in scenarios such as when the user is browsing news, shopping online, and ordering food.<br>It mainly uses the network positioning technology and therefore the power consumption is relatively low.|
399e41f4b71Sopenharmony_ci| NO_POWER_CONSUMPTION   | 0x603 | No power consumption.<br>Your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application.  |
400e41f4b71Sopenharmony_ci
401e41f4b71Sopenharmony_ci
402e41f4b71Sopenharmony_ci## UserActivityScenario<sup>12+</sup>
403e41f4b71Sopenharmony_ci
404e41f4b71Sopenharmony_ciEnumerates user activity scenarios in a location request.
405e41f4b71Sopenharmony_ci
406e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
407e41f4b71Sopenharmony_ci
408e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
409e41f4b71Sopenharmony_ci
410e41f4b71Sopenharmony_ci> **NOTE**
411e41f4b71Sopenharmony_ci>
412e41f4b71Sopenharmony_ci> If a single location or continuous location is initiated in the NAVIGATION, SPORT, or TRANSPORT scenario, the system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. During the continuous location process, the network positioning technology is used if the GNSS location result cannot be obtained within 30 seconds.
413e41f4b71Sopenharmony_ci
414e41f4b71Sopenharmony_ci| Name| Value| Description|
415e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
416e41f4b71Sopenharmony_ci| NAVIGATION  | 0x401 | Navigation scenario.<br>This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking.<br>It mainly uses the GNSS positioning technology and therefore the power consumption is relatively high.|
417e41f4b71Sopenharmony_ci| SPORT  | 0x402 | Sport scenario.<br>This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications.<br>It mainly uses the GNSS positioning technology and therefore the power consumption is relatively high.|
418e41f4b71Sopenharmony_ci| TRANSPORT   | 0x403 | Travel scenario.<br>This option is applicable to user travel scenarios, such as taxi hailing and public transportation.<br>This option mainly uses the GNSS positioning technology and therefore the power consumption is relatively high. |
419e41f4b71Sopenharmony_ci| DAILY_LIFE_SERVICE   | 0x404 | Daily life service scenario.<br>This option is applicable when your application only needs the approximate location in scenarios such as when the user is browsing news, shopping online, and ordering food.<br>It mainly uses the network positioning technology and therefore the power consumption is relatively low. |
420e41f4b71Sopenharmony_ci
421e41f4b71Sopenharmony_ci
422e41f4b71Sopenharmony_ci## LocatingPriority<sup>12+</sup>
423e41f4b71Sopenharmony_ci
424e41f4b71Sopenharmony_ciEnumerates priority types in a single location request.
425e41f4b71Sopenharmony_ci
426e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
427e41f4b71Sopenharmony_ci
428e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
429e41f4b71Sopenharmony_ci
430e41f4b71Sopenharmony_ci| Name| Value| Description|
431e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
432e41f4b71Sopenharmony_ci| PRIORITY_ACCURACY  | 0x501 | Location accuracy.<br>This policy uses both the GNSS positioning and network positioning technologies and provides the most accurate location result within the specified period of time, which is the smaller one between [SingleLocationRequest](#singlelocationrequest12).locatingTimeoutMs and 30 seconds.<br>This policy can lead to significant hardware resource consumption and power consumption. |
433e41f4b71Sopenharmony_ci| PRIORITY_LOCATING_SPEED  | 0x502 | Fast location preferred. Use this policy if you want to obtain a location as fast as possible.<br>This policy uses the GNSS positioning and network positioning technologies simultaneously to obtain the device location in both the indoor and outdoor scenarios and provides the first obtained location result to your application. This policy can lead to significant hardware resource consumption and power consumption.|
434e41f4b71Sopenharmony_ci
435e41f4b71Sopenharmony_ci
436e41f4b71Sopenharmony_ci## LocationError<sup>12+</sup>
437e41f4b71Sopenharmony_ci
438e41f4b71Sopenharmony_ciEnumerates error codes in a continuous location request.
439e41f4b71Sopenharmony_ci
440e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
441e41f4b71Sopenharmony_ci
442e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
443e41f4b71Sopenharmony_ci
444e41f4b71Sopenharmony_ci| Name| Value| Description|
445e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
446e41f4b71Sopenharmony_ci| LOCATING_FAILED_DEFAULT   | -1 |  Unknown type. This is the default value.|
447e41f4b71Sopenharmony_ci| LOCATING_FAILED_LOCATION_PERMISSION_DENIED   | -2 | Failed to verify the **ohos.permission.APPROXIMATELY_LOCATION** or **ohos.permission.LOCATION** permission.|
448e41f4b71Sopenharmony_ci| LOCATING_FAILED_BACKGROUND_PERMISSION_DENIED    | -3 | Failed to verify the location permission when the application is running in the background. For details about how to apply for the location permission, see [Applying for Location Permissions](../../device/location/location-guidelines.md#applying-for-location-permissions).|
449e41f4b71Sopenharmony_ci| LOCATING_FAILED_LOCATION_SWITCH_OFF    | -4 | Location switch turned off.|
450e41f4b71Sopenharmony_ci| LOCATING_FAILED_INTERNET_ACCESS_FAILURE    | -5 | Network access denied.|
451e41f4b71Sopenharmony_ci
452e41f4b71Sopenharmony_ci
453e41f4b71Sopenharmony_ci## LocationSourceType<sup>12+</sup>
454e41f4b71Sopenharmony_ci
455e41f4b71Sopenharmony_ciDefines the source of the location result.
456e41f4b71Sopenharmony_ci
457e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
458e41f4b71Sopenharmony_ci
459e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
460e41f4b71Sopenharmony_ci
461e41f4b71Sopenharmony_ci| Name| Value| Description|
462e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
463e41f4b71Sopenharmony_ci| GNSS   | 1 |  GNSS positioning technology.|
464e41f4b71Sopenharmony_ci| NETWORK    | 2 | Network positioning technology.|
465e41f4b71Sopenharmony_ci| INDOOR     | 3 | Indoor high-precision positioning technology.|
466e41f4b71Sopenharmony_ci| RTK     | 4 | Outdoor high-precision positioning technology.|
467e41f4b71Sopenharmony_ci
468e41f4b71Sopenharmony_ci
469e41f4b71Sopenharmony_ci## geoLocationManager.on('locationChange')
470e41f4b71Sopenharmony_ci
471e41f4b71Sopenharmony_cion(type: 'locationChange', request: LocationRequest | ContinuousLocationRequest, callback: Callback&lt;Location&gt;): void
472e41f4b71Sopenharmony_ci
473e41f4b71Sopenharmony_ciSubscribes to location change events with a location request initiated. This API uses an asynchronous callback to return the result.
474e41f4b71Sopenharmony_ci
475e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
476e41f4b71Sopenharmony_ci
477e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
478e41f4b71Sopenharmony_ci
479e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
480e41f4b71Sopenharmony_ci
481e41f4b71Sopenharmony_ci**Parameters**
482e41f4b71Sopenharmony_ci
483e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
484e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
485e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **locationChange** indicates a location change.|
486e41f4b71Sopenharmony_ci  | request |  [LocationRequest](#locationrequest) &#124; [ContinuousLocationRequest](#continuouslocationrequest12) | Yes| Location request.<br>**ContinuousLocationRequest** is newly added in API version 12.|
487e41f4b71Sopenharmony_ci  | callback | Callback&lt;[Location](#location)&gt; | Yes| Callback used to return the result.|
488e41f4b71Sopenharmony_ci
489e41f4b71Sopenharmony_ci**Error codes**
490e41f4b71Sopenharmony_ci
491e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
492e41f4b71Sopenharmony_ci
493e41f4b71Sopenharmony_ci| ID| Error Message|
494e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
495e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
496e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
497e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities.          |
498e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
499e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
500e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.                                       |
501e41f4b71Sopenharmony_ci
502e41f4b71Sopenharmony_ci**Example**
503e41f4b71Sopenharmony_ci
504e41f4b71Sopenharmony_ci  ```ts
505e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
506e41f4b71Sopenharmony_ci
507e41f4b71Sopenharmony_ci  // Method 1: Use LocationRequest as the input parameter.
508e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.LocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET, 'timeInterval': 1, 'distanceInterval': 0, 'maxAccuracy': 0};
509e41f4b71Sopenharmony_ci  let locationChange = (location:geoLocationManager.Location):void => {
510e41f4b71Sopenharmony_ci      console.log('locationChanger: data: ' + JSON.stringify(location));
511e41f4b71Sopenharmony_ci  };
512e41f4b71Sopenharmony_ci  try {
513e41f4b71Sopenharmony_ci      geoLocationManager.on('locationChange', requestInfo, locationChange);
514e41f4b71Sopenharmony_ci  } catch (err) {
515e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
516e41f4b71Sopenharmony_ci  }
517e41f4b71Sopenharmony_ci
518e41f4b71Sopenharmony_ci  // Method 2: Use ContinuousLocationRequest as the input parameter.
519e41f4b71Sopenharmony_ci  let request:geoLocationManager.ContinuousLocationRequest = {'interval': 1, 'locationScenario': geoLocationManager.UserActivityScenario.NAVIGATION};
520e41f4b71Sopenharmony_ci  let locationCallback = (location:geoLocationManager.Location):void => {
521e41f4b71Sopenharmony_ci      console.log('locationCallback: data: ' + JSON.stringify(location));
522e41f4b71Sopenharmony_ci  };
523e41f4b71Sopenharmony_ci  try {
524e41f4b71Sopenharmony_ci      geoLocationManager.on('locationChange', request, locationCallback);
525e41f4b71Sopenharmony_ci  } catch (err) {
526e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
527e41f4b71Sopenharmony_ci  }
528e41f4b71Sopenharmony_ci  ```
529e41f4b71Sopenharmony_ci
530e41f4b71Sopenharmony_ci
531e41f4b71Sopenharmony_ci## geoLocationManager.off('locationChange')
532e41f4b71Sopenharmony_ci
533e41f4b71Sopenharmony_cioff(type: 'locationChange', callback?: Callback&lt;Location&gt;): void
534e41f4b71Sopenharmony_ci
535e41f4b71Sopenharmony_ciUnregisters the listener for location change events with the corresponding location request deleted.
536e41f4b71Sopenharmony_ci
537e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
538e41f4b71Sopenharmony_ci
539e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
540e41f4b71Sopenharmony_ci
541e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
542e41f4b71Sopenharmony_ci
543e41f4b71Sopenharmony_ci**Parameters**
544e41f4b71Sopenharmony_ci
545e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
546e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
547e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **locationChange** indicates a location change.|
548e41f4b71Sopenharmony_ci  | callback | Callback&lt;[Location](#location)&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
549e41f4b71Sopenharmony_ci
550e41f4b71Sopenharmony_ci**Error codes**
551e41f4b71Sopenharmony_ci
552e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
553e41f4b71Sopenharmony_ci
554e41f4b71Sopenharmony_ci| ID| Error Message|
555e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
556e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
557e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
558e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('locationChange')} due to limited device capabilities.          |
559e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
560e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
561e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.                                       |
562e41f4b71Sopenharmony_ci
563e41f4b71Sopenharmony_ci**Example**
564e41f4b71Sopenharmony_ci
565e41f4b71Sopenharmony_ci  ```ts
566e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
567e41f4b71Sopenharmony_ci
568e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.LocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET, 'timeInterval': 1, 'distanceInterval': 0, 'maxAccuracy': 0};
569e41f4b71Sopenharmony_ci  let locationChange = (location:geoLocationManager.Location):void => {
570e41f4b71Sopenharmony_ci    console.log('locationChanger: data: ' + JSON.stringify(location));
571e41f4b71Sopenharmony_ci  };
572e41f4b71Sopenharmony_ci  try {
573e41f4b71Sopenharmony_ci      geoLocationManager.on('locationChange', requestInfo, locationChange);
574e41f4b71Sopenharmony_ci      geoLocationManager.off('locationChange', locationChange);
575e41f4b71Sopenharmony_ci  } catch (err) {
576e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
577e41f4b71Sopenharmony_ci  }
578e41f4b71Sopenharmony_ci  ```
579e41f4b71Sopenharmony_ci
580e41f4b71Sopenharmony_ci
581e41f4b71Sopenharmony_ci## geoLocationManager.on('locationError')<sup>12+</sup>
582e41f4b71Sopenharmony_ci
583e41f4b71Sopenharmony_cion(type: 'locationError', callback: Callback&lt;LocationError&gt;): void;
584e41f4b71Sopenharmony_ci
585e41f4b71Sopenharmony_ciRegisters a listener for error codes generated during continuous location. This API uses an asynchronous callback to return the result.
586e41f4b71Sopenharmony_ci
587e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
588e41f4b71Sopenharmony_ci
589e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
590e41f4b71Sopenharmony_ci
591e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
592e41f4b71Sopenharmony_ci
593e41f4b71Sopenharmony_ci**Parameters**
594e41f4b71Sopenharmony_ci
595e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
596e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
597e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. To subscribe to error codes generated during continuous location, set the value to **locationError**.|
598e41f4b71Sopenharmony_ci  | callback | Callback&lt;[LocationError](#locationerror12)&gt; | Yes| Callback used to return the result.|
599e41f4b71Sopenharmony_ci
600e41f4b71Sopenharmony_ci**Error codes**
601e41f4b71Sopenharmony_ci
602e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
603e41f4b71Sopenharmony_ci
604e41f4b71Sopenharmony_ci| ID| Error Message|
605e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
606e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
607e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
608e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('locationError')} due to limited device capabilities.          |
609e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
610e41f4b71Sopenharmony_ci
611e41f4b71Sopenharmony_ci**Example**
612e41f4b71Sopenharmony_ci
613e41f4b71Sopenharmony_ci  ```ts
614e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
615e41f4b71Sopenharmony_ci
616e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.LocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET, 'timeInterval': 1, 'distanceInterval': 0, 'maxAccuracy': 0};
617e41f4b71Sopenharmony_ci  let locationChange = (location:geoLocationManager.Location):void => {
618e41f4b71Sopenharmony_ci      console.log('locationChanger: data: ' + JSON.stringify(location));
619e41f4b71Sopenharmony_ci  };
620e41f4b71Sopenharmony_ci  try {
621e41f4b71Sopenharmony_ci      geoLocationManager.on('locationChange', requestInfo, locationChange);
622e41f4b71Sopenharmony_ci  } catch (err) {
623e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
624e41f4b71Sopenharmony_ci  }
625e41f4b71Sopenharmony_ci
626e41f4b71Sopenharmony_ci  let locationErrorChange = (errcode: geoLocationManager.LocationError):void => {
627e41f4b71Sopenharmony_ci    console.log('locationErrorChange: data: ' + JSON.stringify(errcode));
628e41f4b71Sopenharmony_ci  };
629e41f4b71Sopenharmony_ci  try {
630e41f4b71Sopenharmony_ci    geoLocationManager.on('locationError', locationErrorChange);
631e41f4b71Sopenharmony_ci  } catch (err) {
632e41f4b71Sopenharmony_ci    console.error("errCode:" + JSON.stringify(err));
633e41f4b71Sopenharmony_ci  }
634e41f4b71Sopenharmony_ci  
635e41f4b71Sopenharmony_ci  ```
636e41f4b71Sopenharmony_ci
637e41f4b71Sopenharmony_ci
638e41f4b71Sopenharmony_ci## geoLocationManager.off('locationError')<sup>12+</sup>
639e41f4b71Sopenharmony_ci
640e41f4b71Sopenharmony_cioff(type: 'locationError', callback?: Callback&lt;LocationError&gt;): void
641e41f4b71Sopenharmony_ci
642e41f4b71Sopenharmony_ciUnregisters the listener for error codes generated during continuous location.
643e41f4b71Sopenharmony_ci
644e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
645e41f4b71Sopenharmony_ci
646e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
647e41f4b71Sopenharmony_ci
648e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
649e41f4b71Sopenharmony_ci
650e41f4b71Sopenharmony_ci**Parameters**
651e41f4b71Sopenharmony_ci
652e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
653e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
654e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. To subscribe to error codes generated during continuous location, set the value to **locationError**.|
655e41f4b71Sopenharmony_ci  | callback | Callback&lt;[LocationError](#locationerror12)&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
656e41f4b71Sopenharmony_ci
657e41f4b71Sopenharmony_ci**Error codes**
658e41f4b71Sopenharmony_ci
659e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
660e41f4b71Sopenharmony_ci
661e41f4b71Sopenharmony_ci| ID| Error Message|
662e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
663e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
664e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
665e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('locationError')} due to limited device capabilities.          |
666e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
667e41f4b71Sopenharmony_ci
668e41f4b71Sopenharmony_ci**Example**
669e41f4b71Sopenharmony_ci
670e41f4b71Sopenharmony_ci  ```ts
671e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
672e41f4b71Sopenharmony_ci
673e41f4b71Sopenharmony_ci  let locationErrorChange = (errcode: geoLocationManager.LocationError):void => {
674e41f4b71Sopenharmony_ci    console.log('locationErrorChange: data: ' + JSON.stringify(errcode));
675e41f4b71Sopenharmony_ci  };
676e41f4b71Sopenharmony_ci  try {
677e41f4b71Sopenharmony_ci    geoLocationManager.on('locationError', locationErrorChange);
678e41f4b71Sopenharmony_ci    geoLocationManager.off('locationError', locationErrorChange);
679e41f4b71Sopenharmony_ci  } catch (err) {
680e41f4b71Sopenharmony_ci    console.error("errCode:" + JSON.stringify(err));
681e41f4b71Sopenharmony_ci  }
682e41f4b71Sopenharmony_ci  ```
683e41f4b71Sopenharmony_ci
684e41f4b71Sopenharmony_ci
685e41f4b71Sopenharmony_ci## geoLocationManager.on('locationEnabledChange')
686e41f4b71Sopenharmony_ci
687e41f4b71Sopenharmony_cion(type: 'locationEnabledChange', callback: Callback&lt;boolean&gt;): void
688e41f4b71Sopenharmony_ci
689e41f4b71Sopenharmony_ciSubscribes to location service status change events. This API uses an asynchronous callback to return the result.
690e41f4b71Sopenharmony_ci
691e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
692e41f4b71Sopenharmony_ci
693e41f4b71Sopenharmony_ci**Parameters**
694e41f4b71Sopenharmony_ci
695e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
696e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
697e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change.|
698e41f4b71Sopenharmony_ci  | callback | Callback&lt;boolean&gt; | Yes| Callback used to return the result. The value **true** indicates that the location switch is enabled and the value **false** indicates the opposite.|
699e41f4b71Sopenharmony_ci
700e41f4b71Sopenharmony_ci**Error codes**
701e41f4b71Sopenharmony_ci
702e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
703e41f4b71Sopenharmony_ci
704e41f4b71Sopenharmony_ci| ID| Error Message|
705e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
706e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
707e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('locationEnabledChange')} due to limited device capabilities.          |
708e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
709e41f4b71Sopenharmony_ci
710e41f4b71Sopenharmony_ci**Example**
711e41f4b71Sopenharmony_ci
712e41f4b71Sopenharmony_ci  ```ts
713e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
714e41f4b71Sopenharmony_ci
715e41f4b71Sopenharmony_ci  let locationEnabledChange = (state:boolean):void => {
716e41f4b71Sopenharmony_ci      console.log('locationEnabledChange: ' + JSON.stringify(state));
717e41f4b71Sopenharmony_ci  }
718e41f4b71Sopenharmony_ci  try {
719e41f4b71Sopenharmony_ci      geoLocationManager.on('locationEnabledChange', locationEnabledChange);
720e41f4b71Sopenharmony_ci  } catch (err) {
721e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
722e41f4b71Sopenharmony_ci  }
723e41f4b71Sopenharmony_ci  ```
724e41f4b71Sopenharmony_ci
725e41f4b71Sopenharmony_ci
726e41f4b71Sopenharmony_ci## geoLocationManager.off('locationEnabledChange')
727e41f4b71Sopenharmony_ci
728e41f4b71Sopenharmony_cioff(type: 'locationEnabledChange', callback?: Callback&lt;boolean&gt;): void;
729e41f4b71Sopenharmony_ci
730e41f4b71Sopenharmony_ciUnsubscribes from location service status change events.
731e41f4b71Sopenharmony_ci
732e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
733e41f4b71Sopenharmony_ci
734e41f4b71Sopenharmony_ci**Parameters**
735e41f4b71Sopenharmony_ci
736e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
737e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
738e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change.|
739e41f4b71Sopenharmony_ci  | callback | Callback&lt;boolean&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
740e41f4b71Sopenharmony_ci
741e41f4b71Sopenharmony_ci**Error codes**
742e41f4b71Sopenharmony_ci
743e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
744e41f4b71Sopenharmony_ci
745e41f4b71Sopenharmony_ci| ID| Error Message|
746e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
747e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
748e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('locationEnabledChange')} due to limited device capabilities.          |
749e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
750e41f4b71Sopenharmony_ci
751e41f4b71Sopenharmony_ci**Example**
752e41f4b71Sopenharmony_ci
753e41f4b71Sopenharmony_ci  ```ts
754e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
755e41f4b71Sopenharmony_ci
756e41f4b71Sopenharmony_ci  let locationEnabledChange = (state:boolean):void => {
757e41f4b71Sopenharmony_ci      console.log('locationEnabledChange: state: ' + JSON.stringify(state));
758e41f4b71Sopenharmony_ci  }
759e41f4b71Sopenharmony_ci  try {
760e41f4b71Sopenharmony_ci      geoLocationManager.on('locationEnabledChange', locationEnabledChange);
761e41f4b71Sopenharmony_ci      geoLocationManager.off('locationEnabledChange', locationEnabledChange);
762e41f4b71Sopenharmony_ci  } catch (err) {
763e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
764e41f4b71Sopenharmony_ci  }
765e41f4b71Sopenharmony_ci  ```
766e41f4b71Sopenharmony_ci
767e41f4b71Sopenharmony_ci
768e41f4b71Sopenharmony_ci## geoLocationManager.on('cachedGnssLocationsChange')
769e41f4b71Sopenharmony_ci
770e41f4b71Sopenharmony_cion(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback&lt;Array&lt;Location&gt;&gt;): void;
771e41f4b71Sopenharmony_ci
772e41f4b71Sopenharmony_ciSubscribes to cached GNSS location reports. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported. This API uses an asynchronous callback to return the result.
773e41f4b71Sopenharmony_ci
774e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
775e41f4b71Sopenharmony_ci
776e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
777e41f4b71Sopenharmony_ci
778e41f4b71Sopenharmony_ci**Parameters**
779e41f4b71Sopenharmony_ci
780e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
781e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
782e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **cachedGnssLocationsChange** indicates reporting of cached GNSS locations.|
783e41f4b71Sopenharmony_ci  | request |  [CachedGnssLocationsRequest](#cachedgnsslocationsrequest) | Yes| Request for reporting cached GNSS location.|
784e41f4b71Sopenharmony_ci  | callback | Callback&lt;Array&lt;[Location](#location)&gt;&gt; | Yes| Callback used to return the result.|
785e41f4b71Sopenharmony_ci
786e41f4b71Sopenharmony_ci**Error codes**
787e41f4b71Sopenharmony_ci
788e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
789e41f4b71Sopenharmony_ci
790e41f4b71Sopenharmony_ci| ID| Error Message|
791e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
792e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
793e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
794e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('cachedGnssLocationsChange')} due to limited device capabilities.          |
795e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
796e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
797e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.                                       |
798e41f4b71Sopenharmony_ci
799e41f4b71Sopenharmony_ci**Example**
800e41f4b71Sopenharmony_ci
801e41f4b71Sopenharmony_ci  ```ts
802e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
803e41f4b71Sopenharmony_ci
804e41f4b71Sopenharmony_ci  let cachedLocationsCb = (locations:Array<geoLocationManager.Location>):void => {
805e41f4b71Sopenharmony_ci      console.log('cachedGnssLocationsChange: locations: ' + JSON.stringify(locations));
806e41f4b71Sopenharmony_ci  }
807e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.CachedGnssLocationsRequest = {'reportingPeriodSec': 10, 'wakeUpCacheQueueFull': true};
808e41f4b71Sopenharmony_ci  try {
809e41f4b71Sopenharmony_ci      geoLocationManager.on('cachedGnssLocationsChange', requestInfo, cachedLocationsCb);
810e41f4b71Sopenharmony_ci  } catch (err) {
811e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
812e41f4b71Sopenharmony_ci  }
813e41f4b71Sopenharmony_ci  ```
814e41f4b71Sopenharmony_ci
815e41f4b71Sopenharmony_ci
816e41f4b71Sopenharmony_ci## geoLocationManager.off('cachedGnssLocationsChange')
817e41f4b71Sopenharmony_ci
818e41f4b71Sopenharmony_cioff(type: 'cachedGnssLocationsChange', callback?: Callback&lt;Array&lt;Location&gt;&gt;): void;
819e41f4b71Sopenharmony_ci
820e41f4b71Sopenharmony_ciUnsubscribes from cached GNSS location reports. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported.
821e41f4b71Sopenharmony_ci
822e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
823e41f4b71Sopenharmony_ci
824e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
825e41f4b71Sopenharmony_ci
826e41f4b71Sopenharmony_ci**Parameters**
827e41f4b71Sopenharmony_ci
828e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
829e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
830e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **cachedGnssLocationsChange** indicates reporting of cached GNSS locations.|
831e41f4b71Sopenharmony_ci  | callback | Callback&lt;Array&lt;[Location](#location)&gt;&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
832e41f4b71Sopenharmony_ci
833e41f4b71Sopenharmony_ci**Error codes**
834e41f4b71Sopenharmony_ci
835e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
836e41f4b71Sopenharmony_ci
837e41f4b71Sopenharmony_ci| ID| Error Message|
838e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
839e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
840e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
841e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('cachedGnssLocationsChange')} due to limited device capabilities.          |
842e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
843e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
844e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.                                       |
845e41f4b71Sopenharmony_ci
846e41f4b71Sopenharmony_ci**Example**
847e41f4b71Sopenharmony_ci
848e41f4b71Sopenharmony_ci  ```ts
849e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
850e41f4b71Sopenharmony_ci
851e41f4b71Sopenharmony_ci  let cachedLocationsCb = (locations:Array<geoLocationManager.Location>):void => {
852e41f4b71Sopenharmony_ci      console.log('cachedGnssLocationsChange: locations: ' + JSON.stringify(locations));
853e41f4b71Sopenharmony_ci  }
854e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.CachedGnssLocationsRequest = {'reportingPeriodSec': 10, 'wakeUpCacheQueueFull': true};
855e41f4b71Sopenharmony_ci  try {
856e41f4b71Sopenharmony_ci      geoLocationManager.on('cachedGnssLocationsChange', requestInfo, cachedLocationsCb);
857e41f4b71Sopenharmony_ci      geoLocationManager.off('cachedGnssLocationsChange');
858e41f4b71Sopenharmony_ci  } catch (err) {
859e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
860e41f4b71Sopenharmony_ci  }
861e41f4b71Sopenharmony_ci  ```
862e41f4b71Sopenharmony_ci
863e41f4b71Sopenharmony_ci
864e41f4b71Sopenharmony_ci## geoLocationManager.on('satelliteStatusChange')
865e41f4b71Sopenharmony_ci
866e41f4b71Sopenharmony_cion(type: 'satelliteStatusChange', callback: Callback&lt;SatelliteStatusInfo&gt;): void;
867e41f4b71Sopenharmony_ci
868e41f4b71Sopenharmony_ciSubscribes to GNSS satellite status change events. This API uses an asynchronous callback to return the result.
869e41f4b71Sopenharmony_ci
870e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
871e41f4b71Sopenharmony_ci
872e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
873e41f4b71Sopenharmony_ci
874e41f4b71Sopenharmony_ci**Parameters**
875e41f4b71Sopenharmony_ci
876e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
877e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
878e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change.|
879e41f4b71Sopenharmony_ci  | callback | Callback&lt;[SatelliteStatusInfo](#satellitestatusinfo)&gt; | Yes| Callback used to return the result.|
880e41f4b71Sopenharmony_ci
881e41f4b71Sopenharmony_ci**Error codes**
882e41f4b71Sopenharmony_ci
883e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
884e41f4b71Sopenharmony_ci
885e41f4b71Sopenharmony_ci| ID| Error Message|
886e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
887e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
888e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
889e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('satelliteStatusChange')} due to limited device capabilities.          |
890e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
891e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
892e41f4b71Sopenharmony_ci
893e41f4b71Sopenharmony_ci**Example**
894e41f4b71Sopenharmony_ci
895e41f4b71Sopenharmony_ci  ```ts
896e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
897e41f4b71Sopenharmony_ci
898e41f4b71Sopenharmony_ci  let gnssStatusCb = (satelliteStatusInfo:geoLocationManager.SatelliteStatusInfo):void => {
899e41f4b71Sopenharmony_ci      console.log('satelliteStatusChange: ' + JSON.stringify(satelliteStatusInfo));
900e41f4b71Sopenharmony_ci  }
901e41f4b71Sopenharmony_ci
902e41f4b71Sopenharmony_ci  try {
903e41f4b71Sopenharmony_ci      geoLocationManager.on('satelliteStatusChange', gnssStatusCb);
904e41f4b71Sopenharmony_ci  } catch (err) {
905e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
906e41f4b71Sopenharmony_ci  }
907e41f4b71Sopenharmony_ci  ```
908e41f4b71Sopenharmony_ci
909e41f4b71Sopenharmony_ci
910e41f4b71Sopenharmony_ci## geoLocationManager.off('satelliteStatusChange')
911e41f4b71Sopenharmony_ci
912e41f4b71Sopenharmony_cioff(type: 'satelliteStatusChange', callback?: Callback&lt;SatelliteStatusInfo&gt;): void;
913e41f4b71Sopenharmony_ci
914e41f4b71Sopenharmony_ciUnsubscribes from GNSS satellite status change events.
915e41f4b71Sopenharmony_ci
916e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
917e41f4b71Sopenharmony_ci
918e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
919e41f4b71Sopenharmony_ci
920e41f4b71Sopenharmony_ci**Parameters**
921e41f4b71Sopenharmony_ci
922e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
923e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
924e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change.|
925e41f4b71Sopenharmony_ci  | callback | Callback&lt;[SatelliteStatusInfo](#satellitestatusinfo)&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
926e41f4b71Sopenharmony_ci
927e41f4b71Sopenharmony_ci**Error codes**
928e41f4b71Sopenharmony_ci
929e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
930e41f4b71Sopenharmony_ci
931e41f4b71Sopenharmony_ci| ID| Error Message|
932e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
933e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
934e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
935e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('satelliteStatusChange')} due to limited device capabilities.          |
936e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
937e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
938e41f4b71Sopenharmony_ci
939e41f4b71Sopenharmony_ci
940e41f4b71Sopenharmony_ci**Example**
941e41f4b71Sopenharmony_ci
942e41f4b71Sopenharmony_ci  ```ts
943e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
944e41f4b71Sopenharmony_ci
945e41f4b71Sopenharmony_ci  let gnssStatusCb = (satelliteStatusInfo:geoLocationManager.SatelliteStatusInfo):void => {
946e41f4b71Sopenharmony_ci      console.log('satelliteStatusChange: ' + JSON.stringify(satelliteStatusInfo));
947e41f4b71Sopenharmony_ci  }
948e41f4b71Sopenharmony_ci  try {
949e41f4b71Sopenharmony_ci      geoLocationManager.on('satelliteStatusChange', gnssStatusCb);
950e41f4b71Sopenharmony_ci      geoLocationManager.off('satelliteStatusChange', gnssStatusCb);
951e41f4b71Sopenharmony_ci  } catch (err) {
952e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
953e41f4b71Sopenharmony_ci  }
954e41f4b71Sopenharmony_ci  ```
955e41f4b71Sopenharmony_ci
956e41f4b71Sopenharmony_ci
957e41f4b71Sopenharmony_ci## geoLocationManager.on('nmeaMessage')
958e41f4b71Sopenharmony_ci
959e41f4b71Sopenharmony_cion(type: 'nmeaMessage', callback: Callback&lt;string&gt;): void;
960e41f4b71Sopenharmony_ci
961e41f4b71Sopenharmony_ciSubscribes to GNSS NMEA message change events. This API uses an asynchronous callback to return the result.
962e41f4b71Sopenharmony_ci
963e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
964e41f4b71Sopenharmony_ci
965e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
966e41f4b71Sopenharmony_ci
967e41f4b71Sopenharmony_ci**Parameters**
968e41f4b71Sopenharmony_ci
969e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
970e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
971e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change.|
972e41f4b71Sopenharmony_ci  | callback | Callback&lt;string&gt; | Yes| Callback used to return the result.|
973e41f4b71Sopenharmony_ci
974e41f4b71Sopenharmony_ci**Error codes**
975e41f4b71Sopenharmony_ci
976e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
977e41f4b71Sopenharmony_ci
978e41f4b71Sopenharmony_ci| ID| Error Message|
979e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
980e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
981e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
982e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('nmeaMessage')} due to limited device capabilities.          |
983e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
984e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
985e41f4b71Sopenharmony_ci
986e41f4b71Sopenharmony_ci
987e41f4b71Sopenharmony_ci**Example**
988e41f4b71Sopenharmony_ci
989e41f4b71Sopenharmony_ci  ```ts
990e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
991e41f4b71Sopenharmony_ci
992e41f4b71Sopenharmony_ci  let nmeaCb = (str:string):void => {
993e41f4b71Sopenharmony_ci      console.log('nmeaMessage: ' + JSON.stringify(str));
994e41f4b71Sopenharmony_ci  }
995e41f4b71Sopenharmony_ci
996e41f4b71Sopenharmony_ci  try {
997e41f4b71Sopenharmony_ci      geoLocationManager.on('nmeaMessage', nmeaCb );
998e41f4b71Sopenharmony_ci  } catch (err) {
999e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1000e41f4b71Sopenharmony_ci  }
1001e41f4b71Sopenharmony_ci  ```
1002e41f4b71Sopenharmony_ci
1003e41f4b71Sopenharmony_ci
1004e41f4b71Sopenharmony_ci## geoLocationManager.off('nmeaMessage')
1005e41f4b71Sopenharmony_ci
1006e41f4b71Sopenharmony_cioff(type: 'nmeaMessage', callback?: Callback&lt;string&gt;): void;
1007e41f4b71Sopenharmony_ci
1008e41f4b71Sopenharmony_ciUnsubscribes from GNSS NMEA message change events.
1009e41f4b71Sopenharmony_ci
1010e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1011e41f4b71Sopenharmony_ci
1012e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
1013e41f4b71Sopenharmony_ci
1014e41f4b71Sopenharmony_ci**Parameters**
1015e41f4b71Sopenharmony_ci
1016e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1017e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1018e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change.|
1019e41f4b71Sopenharmony_ci  | callback | Callback&lt;string&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
1020e41f4b71Sopenharmony_ci
1021e41f4b71Sopenharmony_ci**Error codes**
1022e41f4b71Sopenharmony_ci
1023e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1024e41f4b71Sopenharmony_ci
1025e41f4b71Sopenharmony_ci| ID| Error Message|
1026e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1027e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1028e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1029e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('nmeaMessage')} due to limited device capabilities.          |
1030e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1031e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
1032e41f4b71Sopenharmony_ci
1033e41f4b71Sopenharmony_ci
1034e41f4b71Sopenharmony_ci**Example**
1035e41f4b71Sopenharmony_ci
1036e41f4b71Sopenharmony_ci  ```ts
1037e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1038e41f4b71Sopenharmony_ci
1039e41f4b71Sopenharmony_ci  let nmeaCb = (str:string):void => {
1040e41f4b71Sopenharmony_ci      console.log('nmeaMessage: ' + JSON.stringify(str));
1041e41f4b71Sopenharmony_ci  }
1042e41f4b71Sopenharmony_ci
1043e41f4b71Sopenharmony_ci  try {
1044e41f4b71Sopenharmony_ci      geoLocationManager.on('nmeaMessage', nmeaCb);
1045e41f4b71Sopenharmony_ci      geoLocationManager.off('nmeaMessage', nmeaCb);
1046e41f4b71Sopenharmony_ci  } catch (err) {
1047e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1048e41f4b71Sopenharmony_ci  }
1049e41f4b71Sopenharmony_ci  ```
1050e41f4b71Sopenharmony_ci
1051e41f4b71Sopenharmony_ci
1052e41f4b71Sopenharmony_ci## geoLocationManager.on('gnssFenceStatusChange')
1053e41f4b71Sopenharmony_ci
1054e41f4b71Sopenharmony_cion(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
1055e41f4b71Sopenharmony_ci
1056e41f4b71Sopenharmony_ciSubscribes to status change events of the specified geofence. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported.
1057e41f4b71Sopenharmony_ci
1058e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1059e41f4b71Sopenharmony_ci
1060e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
1061e41f4b71Sopenharmony_ci
1062e41f4b71Sopenharmony_ci**Parameters**
1063e41f4b71Sopenharmony_ci
1064e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1065e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1066e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **gnssFenceStatusChange** indicates a geofence status change.|
1067e41f4b71Sopenharmony_ci  | request |  [GeofenceRequest](#geofencerequest) | Yes| Geofencing request.|
1068e41f4b71Sopenharmony_ci  | want | [WantAgent](../apis-ability-kit/js-apis-app-ability-wantAgent.md) | Yes| **WantAgent** used to receive geofence (entrance or exit) events.|
1069e41f4b71Sopenharmony_ci
1070e41f4b71Sopenharmony_ci**Error codes**
1071e41f4b71Sopenharmony_ci
1072e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1073e41f4b71Sopenharmony_ci
1074e41f4b71Sopenharmony_ci| ID| Error Message|
1075e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1076e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1077e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1078e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('gnssFenceStatusChange')} due to limited device capabilities.          |
1079e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1080e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
1081e41f4b71Sopenharmony_ci|3301600 | Failed to operate the geofence.                                     |
1082e41f4b71Sopenharmony_ci
1083e41f4b71Sopenharmony_ci**Example**
1084e41f4b71Sopenharmony_ci
1085e41f4b71Sopenharmony_ci  ```ts
1086e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1087e41f4b71Sopenharmony_ci  import { wantAgent } from '@kit.AbilityKit'
1088e41f4b71Sopenharmony_ci
1089e41f4b71Sopenharmony_ci
1090e41f4b71Sopenharmony_ci  let wantAgentInfo:wantAgent.WantAgentInfo = {
1091e41f4b71Sopenharmony_ci      wants: [
1092e41f4b71Sopenharmony_ci          {
1093e41f4b71Sopenharmony_ci              bundleName: "com.example.myapplication",
1094e41f4b71Sopenharmony_ci              abilityName: "EntryAbility",
1095e41f4b71Sopenharmony_ci              action: "action1"
1096e41f4b71Sopenharmony_ci          }
1097e41f4b71Sopenharmony_ci      ],
1098e41f4b71Sopenharmony_ci      operationType: wantAgent.OperationType.START_ABILITY,
1099e41f4b71Sopenharmony_ci      requestCode: 0,
1100e41f4b71Sopenharmony_ci      wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
1101e41f4b71Sopenharmony_ci  };
1102e41f4b71Sopenharmony_ci  
1103e41f4b71Sopenharmony_ci  wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
1104e41f4b71Sopenharmony_ci    let requestInfo:geoLocationManager.GeofenceRequest = {'scenario': 0x301, "geofence": {"latitude": 31.12, "longitude": 121.11, "radius": 100, "expiration": 10000}};
1105e41f4b71Sopenharmony_ci    try {
1106e41f4b71Sopenharmony_ci        geoLocationManager.on('gnssFenceStatusChange', requestInfo, wantAgentObj);
1107e41f4b71Sopenharmony_ci    } catch (err) {
1108e41f4b71Sopenharmony_ci        console.error("errCode:" + JSON.stringify(err));
1109e41f4b71Sopenharmony_ci    }
1110e41f4b71Sopenharmony_ci  });
1111e41f4b71Sopenharmony_ci  ```
1112e41f4b71Sopenharmony_ci
1113e41f4b71Sopenharmony_ci
1114e41f4b71Sopenharmony_ci## geoLocationManager.off('gnssFenceStatusChange')
1115e41f4b71Sopenharmony_ci
1116e41f4b71Sopenharmony_cioff(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
1117e41f4b71Sopenharmony_ci
1118e41f4b71Sopenharmony_ciUnsubscribes from status change events of the specified geofence. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported.
1119e41f4b71Sopenharmony_ci
1120e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1121e41f4b71Sopenharmony_ci
1122e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
1123e41f4b71Sopenharmony_ci
1124e41f4b71Sopenharmony_ci**Parameters**
1125e41f4b71Sopenharmony_ci
1126e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1127e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1128e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **gnssFenceStatusChange** indicates a geofence status change.|
1129e41f4b71Sopenharmony_ci  | request | [GeofenceRequest](#geofencerequest) | Yes| Geofencing request.|
1130e41f4b71Sopenharmony_ci  | want | [WantAgent](../apis-ability-kit/js-apis-app-ability-wantAgent.md) | Yes| **WantAgent** used to receive geofence (entrance or exit) events.|
1131e41f4b71Sopenharmony_ci
1132e41f4b71Sopenharmony_ci**Error codes**
1133e41f4b71Sopenharmony_ci
1134e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1135e41f4b71Sopenharmony_ci
1136e41f4b71Sopenharmony_ci| ID| Error Message|
1137e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1138e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1139e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1140e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('gnssFenceStatusChange')} due to limited device capabilities.          |
1141e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1142e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
1143e41f4b71Sopenharmony_ci|3301600 | Failed to operate the geofence.                                     |
1144e41f4b71Sopenharmony_ci
1145e41f4b71Sopenharmony_ci**Example**
1146e41f4b71Sopenharmony_ci
1147e41f4b71Sopenharmony_ci  ```ts
1148e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1149e41f4b71Sopenharmony_ci  import { wantAgent } from '@kit.AbilityKit'
1150e41f4b71Sopenharmony_ci
1151e41f4b71Sopenharmony_ci  
1152e41f4b71Sopenharmony_ci  let wantAgentInfo:wantAgent.WantAgentInfo = {
1153e41f4b71Sopenharmony_ci      wants: [
1154e41f4b71Sopenharmony_ci          {
1155e41f4b71Sopenharmony_ci              bundleName: "com.example.myapplication",
1156e41f4b71Sopenharmony_ci              abilityName: "EntryAbility",
1157e41f4b71Sopenharmony_ci              action: "action1",
1158e41f4b71Sopenharmony_ci          }
1159e41f4b71Sopenharmony_ci      ],
1160e41f4b71Sopenharmony_ci      operationType: wantAgent.OperationType.START_ABILITY,
1161e41f4b71Sopenharmony_ci      requestCode: 0,
1162e41f4b71Sopenharmony_ci      wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
1163e41f4b71Sopenharmony_ci  };
1164e41f4b71Sopenharmony_ci  
1165e41f4b71Sopenharmony_ci  wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
1166e41f4b71Sopenharmony_ci    let requestInfo:geoLocationManager.GeofenceRequest = {'scenario': 0x301, "geofence": {"latitude": 31.12, "longitude": 121.11, "radius": 100, "expiration": 10000}};;
1167e41f4b71Sopenharmony_ci    try {
1168e41f4b71Sopenharmony_ci        geoLocationManager.on('gnssFenceStatusChange', requestInfo, wantAgentObj);
1169e41f4b71Sopenharmony_ci        geoLocationManager.off('gnssFenceStatusChange', requestInfo, wantAgentObj);
1170e41f4b71Sopenharmony_ci    } catch (err) {
1171e41f4b71Sopenharmony_ci        console.error("errCode:" + JSON.stringify(err));
1172e41f4b71Sopenharmony_ci    }
1173e41f4b71Sopenharmony_ci  });
1174e41f4b71Sopenharmony_ci  ```
1175e41f4b71Sopenharmony_ci
1176e41f4b71Sopenharmony_ci
1177e41f4b71Sopenharmony_ci## geoLocationManager.on('countryCodeChange')
1178e41f4b71Sopenharmony_ci
1179e41f4b71Sopenharmony_cion(type: 'countryCodeChange', callback: Callback&lt;CountryCode&gt;): void;
1180e41f4b71Sopenharmony_ci
1181e41f4b71Sopenharmony_ciSubscribes to country code change events. This API uses an asynchronous callback to return the result.
1182e41f4b71Sopenharmony_ci
1183e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1184e41f4b71Sopenharmony_ci
1185e41f4b71Sopenharmony_ci**Parameters**
1186e41f4b71Sopenharmony_ci
1187e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1188e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1189e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change.|
1190e41f4b71Sopenharmony_ci  | callback | Callback&lt;[CountryCode](#countrycode)&gt; | Yes| Callback used to return the result.|
1191e41f4b71Sopenharmony_ci
1192e41f4b71Sopenharmony_ci**Error codes**
1193e41f4b71Sopenharmony_ci
1194e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1195e41f4b71Sopenharmony_ci
1196e41f4b71Sopenharmony_ci| ID| Error Message|
1197e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1198e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1199e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.on('countryCodeChange')} due to limited device capabilities.          |
1200e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1201e41f4b71Sopenharmony_ci|3301500 | Failed to query the area information.                                       |
1202e41f4b71Sopenharmony_ci
1203e41f4b71Sopenharmony_ci
1204e41f4b71Sopenharmony_ci**Example**
1205e41f4b71Sopenharmony_ci
1206e41f4b71Sopenharmony_ci  ```ts
1207e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1208e41f4b71Sopenharmony_ci
1209e41f4b71Sopenharmony_ci  let callback = (code:geoLocationManager.CountryCode):void => {
1210e41f4b71Sopenharmony_ci      console.log('countryCodeChange: ' + JSON.stringify(code));
1211e41f4b71Sopenharmony_ci  }
1212e41f4b71Sopenharmony_ci
1213e41f4b71Sopenharmony_ci  try {
1214e41f4b71Sopenharmony_ci      geoLocationManager.on('countryCodeChange', callback);
1215e41f4b71Sopenharmony_ci  } catch (err) {
1216e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1217e41f4b71Sopenharmony_ci  }
1218e41f4b71Sopenharmony_ci  ```
1219e41f4b71Sopenharmony_ci
1220e41f4b71Sopenharmony_ci
1221e41f4b71Sopenharmony_ci## geoLocationManager.off('countryCodeChange')
1222e41f4b71Sopenharmony_ci
1223e41f4b71Sopenharmony_cioff(type: 'countryCodeChange', callback?: Callback&lt;CountryCode&gt;): void;
1224e41f4b71Sopenharmony_ci
1225e41f4b71Sopenharmony_ciUnsubscribes from country code change events.
1226e41f4b71Sopenharmony_ci
1227e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1228e41f4b71Sopenharmony_ci
1229e41f4b71Sopenharmony_ci**Parameters**
1230e41f4b71Sopenharmony_ci
1231e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1232e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1233e41f4b71Sopenharmony_ci  | type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change.|
1234e41f4b71Sopenharmony_ci  | callback | Callback&lt;[CountryCode](#countrycode)&gt; | No| Callback to unregister. The callback must be the same as that passed by the **on** API. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
1235e41f4b71Sopenharmony_ci
1236e41f4b71Sopenharmony_ci**Error codes**
1237e41f4b71Sopenharmony_ci
1238e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1239e41f4b71Sopenharmony_ci
1240e41f4b71Sopenharmony_ci| ID| Error Message|
1241e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1242e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1243e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.off('countryCodeChange')} due to limited device capabilities.          |
1244e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1245e41f4b71Sopenharmony_ci|3301500 | Failed to query the area information.                                       |
1246e41f4b71Sopenharmony_ci
1247e41f4b71Sopenharmony_ci**Example**
1248e41f4b71Sopenharmony_ci
1249e41f4b71Sopenharmony_ci  ```ts
1250e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1251e41f4b71Sopenharmony_ci
1252e41f4b71Sopenharmony_ci  let callback = (code:geoLocationManager.CountryCode):void => {
1253e41f4b71Sopenharmony_ci      console.log('countryCodeChange: ' + JSON.stringify(code));
1254e41f4b71Sopenharmony_ci  }
1255e41f4b71Sopenharmony_ci
1256e41f4b71Sopenharmony_ci  try {
1257e41f4b71Sopenharmony_ci      geoLocationManager.on('countryCodeChange', callback);
1258e41f4b71Sopenharmony_ci      geoLocationManager.off('countryCodeChange', callback);
1259e41f4b71Sopenharmony_ci  } catch (err) {
1260e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1261e41f4b71Sopenharmony_ci  }
1262e41f4b71Sopenharmony_ci  ```
1263e41f4b71Sopenharmony_ci
1264e41f4b71Sopenharmony_ci
1265e41f4b71Sopenharmony_ci## geoLocationManager.getCurrentLocation
1266e41f4b71Sopenharmony_ci
1267e41f4b71Sopenharmony_cigetCurrentLocation(request: CurrentLocationRequest | SingleLocationRequest, callback: AsyncCallback&lt;Location&gt;): void
1268e41f4b71Sopenharmony_ci
1269e41f4b71Sopenharmony_ciObtains the current position. This API uses an asynchronous callback to return the result.
1270e41f4b71Sopenharmony_ci
1271e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
1272e41f4b71Sopenharmony_ci
1273e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1274e41f4b71Sopenharmony_ci
1275e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1276e41f4b71Sopenharmony_ci
1277e41f4b71Sopenharmony_ci**Parameters**
1278e41f4b71Sopenharmony_ci
1279e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1280e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1281e41f4b71Sopenharmony_ci  | request | [CurrentLocationRequest](#currentlocationrequest) &#124;  [SingleLocationRequest](#singlelocationrequest12) | Yes| Location request.<br>**SingleLocationRequest** is newly added in API version 12.|
1282e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;[Location](#location)&gt; | Yes| Callback used to return the result.|
1283e41f4b71Sopenharmony_ci
1284e41f4b71Sopenharmony_ci**Error codes**
1285e41f4b71Sopenharmony_ci
1286e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1287e41f4b71Sopenharmony_ci
1288e41f4b71Sopenharmony_ci| ID| Error Message|
1289e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1290e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1291e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1292e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities.          |
1293e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1294e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
1295e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.  |
1296e41f4b71Sopenharmony_ci
1297e41f4b71Sopenharmony_ci**Example**
1298e41f4b71Sopenharmony_ci
1299e41f4b71Sopenharmony_ci  ```ts
1300e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1301e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1302e41f4b71Sopenharmony_ci  // Method 1: Use CurrentLocationRequest as the input parameter.
1303e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.CurrentLocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};
1304e41f4b71Sopenharmony_ci  let locationChange = (err:BusinessError, location:geoLocationManager.Location):void => {
1305e41f4b71Sopenharmony_ci      if (err) {
1306e41f4b71Sopenharmony_ci          console.error('locationChanger: err=' + JSON.stringify(err));
1307e41f4b71Sopenharmony_ci      }
1308e41f4b71Sopenharmony_ci      if (location) {
1309e41f4b71Sopenharmony_ci          console.log('locationChanger: location=' + JSON.stringify(location));
1310e41f4b71Sopenharmony_ci      }
1311e41f4b71Sopenharmony_ci  };
1312e41f4b71Sopenharmony_ci
1313e41f4b71Sopenharmony_ci  try {
1314e41f4b71Sopenharmony_ci      geoLocationManager.getCurrentLocation(requestInfo, locationChange);
1315e41f4b71Sopenharmony_ci  } catch (err) {
1316e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1317e41f4b71Sopenharmony_ci  }
1318e41f4b71Sopenharmony_ci  
1319e41f4b71Sopenharmony_ci  // Method 2: Use SingleLocationRequest as the input parameter.
1320e41f4b71Sopenharmony_ci  let request:geoLocationManager.SingleLocationRequest = {'locatingTimeoutMs': 10000, 'locatingPriority': geoLocationManager.LocatingPriority.PRIORITY_ACCURACY};
1321e41f4b71Sopenharmony_ci  let locationCallback = (err:BusinessError, location:geoLocationManager.Location):void => {
1322e41f4b71Sopenharmony_ci      if (err) {
1323e41f4b71Sopenharmony_ci          console.error('locationChanger: err=' + JSON.stringify(err));
1324e41f4b71Sopenharmony_ci      }
1325e41f4b71Sopenharmony_ci      if (location) {
1326e41f4b71Sopenharmony_ci          console.log('locationChanger: location=' + JSON.stringify(location));
1327e41f4b71Sopenharmony_ci      }
1328e41f4b71Sopenharmony_ci  };
1329e41f4b71Sopenharmony_ci
1330e41f4b71Sopenharmony_ci  try {
1331e41f4b71Sopenharmony_ci      geoLocationManager.getCurrentLocation(request, locationCallback);
1332e41f4b71Sopenharmony_ci  } catch (err) {
1333e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1334e41f4b71Sopenharmony_ci  }
1335e41f4b71Sopenharmony_ci  ```
1336e41f4b71Sopenharmony_ci
1337e41f4b71Sopenharmony_ci## geoLocationManager.getCurrentLocation
1338e41f4b71Sopenharmony_ci
1339e41f4b71Sopenharmony_cigetCurrentLocation(callback: AsyncCallback&lt;Location&gt;): void;
1340e41f4b71Sopenharmony_ci
1341e41f4b71Sopenharmony_ciObtains the current position. This API uses an asynchronous callback to return the result.
1342e41f4b71Sopenharmony_ci
1343e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
1344e41f4b71Sopenharmony_ci
1345e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1346e41f4b71Sopenharmony_ci
1347e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1348e41f4b71Sopenharmony_ci
1349e41f4b71Sopenharmony_ci**Parameters**
1350e41f4b71Sopenharmony_ci
1351e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1352e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1353e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;[Location](#location)&gt; | Yes| Callback used to return the result.|
1354e41f4b71Sopenharmony_ci
1355e41f4b71Sopenharmony_ci**Error codes**
1356e41f4b71Sopenharmony_ci
1357e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1358e41f4b71Sopenharmony_ci
1359e41f4b71Sopenharmony_ci| ID| Error Message|
1360e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1361e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1362e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1363e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities.          |
1364e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1365e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
1366e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.  |
1367e41f4b71Sopenharmony_ci
1368e41f4b71Sopenharmony_ci**Example**
1369e41f4b71Sopenharmony_ci
1370e41f4b71Sopenharmony_ci  ```ts
1371e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1372e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1373e41f4b71Sopenharmony_ci  let locationChange = (err:BusinessError, location:geoLocationManager.Location) => {
1374e41f4b71Sopenharmony_ci      if (err) {
1375e41f4b71Sopenharmony_ci          console.error('locationChanger: err=' + JSON.stringify(err));
1376e41f4b71Sopenharmony_ci      }
1377e41f4b71Sopenharmony_ci      if (location) {
1378e41f4b71Sopenharmony_ci          console.log('locationChanger: location=' + JSON.stringify(location));
1379e41f4b71Sopenharmony_ci      }
1380e41f4b71Sopenharmony_ci  };
1381e41f4b71Sopenharmony_ci
1382e41f4b71Sopenharmony_ci  try {
1383e41f4b71Sopenharmony_ci      geoLocationManager.getCurrentLocation(locationChange);
1384e41f4b71Sopenharmony_ci  } catch (err) {
1385e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1386e41f4b71Sopenharmony_ci  }
1387e41f4b71Sopenharmony_ci  ```
1388e41f4b71Sopenharmony_ci
1389e41f4b71Sopenharmony_ci## geoLocationManager.getCurrentLocation
1390e41f4b71Sopenharmony_ci
1391e41f4b71Sopenharmony_cigetCurrentLocation(request?: CurrentLocationRequest | SingleLocationRequest): Promise&lt;Location&gt;
1392e41f4b71Sopenharmony_ci
1393e41f4b71Sopenharmony_ciObtains the current position. This API uses a promise to return the result.
1394e41f4b71Sopenharmony_ci
1395e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
1396e41f4b71Sopenharmony_ci
1397e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1398e41f4b71Sopenharmony_ci
1399e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1400e41f4b71Sopenharmony_ci
1401e41f4b71Sopenharmony_ci**Parameters**
1402e41f4b71Sopenharmony_ci
1403e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1404e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1405e41f4b71Sopenharmony_ci  | request | [CurrentLocationRequest](#currentlocationrequest) &#124; [SingleLocationRequest](#singlelocationrequest12) | No| Location request.<br>**SingleLocationRequest** is newly added in API version 12.|
1406e41f4b71Sopenharmony_ci
1407e41f4b71Sopenharmony_ci**Return value**
1408e41f4b71Sopenharmony_ci
1409e41f4b71Sopenharmony_ci  | Type| Description|
1410e41f4b71Sopenharmony_ci  | -------- | -------- |
1411e41f4b71Sopenharmony_ci  | Promise&lt;[Location](#location)&gt; | Promise used to return the result.|
1412e41f4b71Sopenharmony_ci
1413e41f4b71Sopenharmony_ci**Error codes**
1414e41f4b71Sopenharmony_ci
1415e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1416e41f4b71Sopenharmony_ci
1417e41f4b71Sopenharmony_ci| ID| Error Message|
1418e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1419e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1420e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1421e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities.          |
1422e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
1423e41f4b71Sopenharmony_ci|3301100 | The location switch is off.                                                 |
1424e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.  |
1425e41f4b71Sopenharmony_ci
1426e41f4b71Sopenharmony_ci**Example**
1427e41f4b71Sopenharmony_ci
1428e41f4b71Sopenharmony_ci  ```ts
1429e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1430e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1431e41f4b71Sopenharmony_ci
1432e41f4b71Sopenharmony_ci  // Method 1: Use CurrentLocationRequest as the input parameter.
1433e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.CurrentLocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};
1434e41f4b71Sopenharmony_ci  try {
1435e41f4b71Sopenharmony_ci      geoLocationManager.getCurrentLocation(requestInfo).then((result) => {
1436e41f4b71Sopenharmony_ci          console.log('current location: ' + JSON.stringify(result));
1437e41f4b71Sopenharmony_ci      })  
1438e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
1439e41f4b71Sopenharmony_ci          console.error('promise, getCurrentLocation: error=' + JSON.stringify(error));
1440e41f4b71Sopenharmony_ci      });
1441e41f4b71Sopenharmony_ci  } catch (err) {
1442e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1443e41f4b71Sopenharmony_ci  }
1444e41f4b71Sopenharmony_ci  
1445e41f4b71Sopenharmony_ci  // Method 2: Use SingleLocationRequest as the input parameter.
1446e41f4b71Sopenharmony_ci  let request:geoLocationManager.SingleLocationRequest = {'locatingTimeoutMs': 10000, 'locatingPriority': geoLocationManager.LocatingPriority.PRIORITY_ACCURACY};
1447e41f4b71Sopenharmony_ci  try {
1448e41f4b71Sopenharmony_ci      geoLocationManager.getCurrentLocation(request).then((result) => {
1449e41f4b71Sopenharmony_ci          console.log('current location: ' + JSON.stringify(result));
1450e41f4b71Sopenharmony_ci      })  
1451e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
1452e41f4b71Sopenharmony_ci          console.error('promise, getCurrentLocation: error=' + JSON.stringify(error));
1453e41f4b71Sopenharmony_ci      });
1454e41f4b71Sopenharmony_ci  } catch (err) {
1455e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1456e41f4b71Sopenharmony_ci  }
1457e41f4b71Sopenharmony_ci  ```
1458e41f4b71Sopenharmony_ci
1459e41f4b71Sopenharmony_ci
1460e41f4b71Sopenharmony_ci## geoLocationManager.getLastLocation
1461e41f4b71Sopenharmony_ci
1462e41f4b71Sopenharmony_cigetLastLocation(): Location
1463e41f4b71Sopenharmony_ci
1464e41f4b71Sopenharmony_ciObtains the last location.
1465e41f4b71Sopenharmony_ci
1466e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
1467e41f4b71Sopenharmony_ci
1468e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1469e41f4b71Sopenharmony_ci
1470e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1471e41f4b71Sopenharmony_ci
1472e41f4b71Sopenharmony_ci**Return value**
1473e41f4b71Sopenharmony_ci
1474e41f4b71Sopenharmony_ci  | Type| Description|
1475e41f4b71Sopenharmony_ci  | -------- | -------- |
1476e41f4b71Sopenharmony_ci  | [Location](#location) | Location information.|
1477e41f4b71Sopenharmony_ci
1478e41f4b71Sopenharmony_ci**Error codes**
1479e41f4b71Sopenharmony_ci
1480e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1481e41f4b71Sopenharmony_ci
1482e41f4b71Sopenharmony_ci| ID| Error Message|
1483e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1484e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1485e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getLastLocation} due to limited device capabilities.          |
1486e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable. |
1487e41f4b71Sopenharmony_ci|3301100 | The location switch is off.  |
1488e41f4b71Sopenharmony_ci|3301200 |Failed to obtain the geographical location.  |
1489e41f4b71Sopenharmony_ci
1490e41f4b71Sopenharmony_ci**Example**
1491e41f4b71Sopenharmony_ci
1492e41f4b71Sopenharmony_ci  ```ts
1493e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1494e41f4b71Sopenharmony_ci  try {
1495e41f4b71Sopenharmony_ci      let location = geoLocationManager.getLastLocation();
1496e41f4b71Sopenharmony_ci  } catch (err) {
1497e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1498e41f4b71Sopenharmony_ci  }
1499e41f4b71Sopenharmony_ci  ```
1500e41f4b71Sopenharmony_ci
1501e41f4b71Sopenharmony_ci
1502e41f4b71Sopenharmony_ci## geoLocationManager.isLocationEnabled
1503e41f4b71Sopenharmony_ci
1504e41f4b71Sopenharmony_ciisLocationEnabled(): boolean
1505e41f4b71Sopenharmony_ci
1506e41f4b71Sopenharmony_ciChecks whether the location service is enabled.
1507e41f4b71Sopenharmony_ci
1508e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
1509e41f4b71Sopenharmony_ci
1510e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1511e41f4b71Sopenharmony_ci
1512e41f4b71Sopenharmony_ci**Return value**
1513e41f4b71Sopenharmony_ci
1514e41f4b71Sopenharmony_ci  | Type| Description|
1515e41f4b71Sopenharmony_ci  | -------- | -------- |
1516e41f4b71Sopenharmony_ci  | boolean | **true**: The location switch is enabled.<br>**false**: The location switch is disabled.|
1517e41f4b71Sopenharmony_ci
1518e41f4b71Sopenharmony_ci**Error codes**
1519e41f4b71Sopenharmony_ci
1520e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1521e41f4b71Sopenharmony_ci
1522e41f4b71Sopenharmony_ci| ID| Error Message|
1523e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1524e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.isLocationEnabled} due to limited device capabilities.          |
1525e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable. |
1526e41f4b71Sopenharmony_ci
1527e41f4b71Sopenharmony_ci**Example**
1528e41f4b71Sopenharmony_ci
1529e41f4b71Sopenharmony_ci  ```ts
1530e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1531e41f4b71Sopenharmony_ci  try {
1532e41f4b71Sopenharmony_ci      let locationEnabled = geoLocationManager.isLocationEnabled();
1533e41f4b71Sopenharmony_ci  } catch (err) {
1534e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1535e41f4b71Sopenharmony_ci  }
1536e41f4b71Sopenharmony_ci  ```
1537e41f4b71Sopenharmony_ci
1538e41f4b71Sopenharmony_ci
1539e41f4b71Sopenharmony_ci## geoLocationManager.getAddressesFromLocation
1540e41f4b71Sopenharmony_ci
1541e41f4b71Sopenharmony_cigetAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback&lt;Array&lt;GeoAddress&gt;&gt;): void
1542e41f4b71Sopenharmony_ci
1543e41f4b71Sopenharmony_ciConverts coordinates into geographic descriptions through reverse geocoding. This API uses an asynchronous callback to return the result. 
1544e41f4b71Sopenharmony_ci
1545e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
1546e41f4b71Sopenharmony_ci
1547e41f4b71Sopenharmony_ci**Parameters**
1548e41f4b71Sopenharmony_ci
1549e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1550e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1551e41f4b71Sopenharmony_ci  | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.|
1552e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | Yes| Callback used to return the result.|
1553e41f4b71Sopenharmony_ci
1554e41f4b71Sopenharmony_ci**Error codes**
1555e41f4b71Sopenharmony_ci
1556e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1557e41f4b71Sopenharmony_ci
1558e41f4b71Sopenharmony_ci| ID| Error Message|
1559e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1560e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1561e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities.          |
1562e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1563e41f4b71Sopenharmony_ci|3301300 | Reverse geocoding query failed.   |
1564e41f4b71Sopenharmony_ci
1565e41f4b71Sopenharmony_ci**Example**
1566e41f4b71Sopenharmony_ci
1567e41f4b71Sopenharmony_ci  ```ts
1568e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1569e41f4b71Sopenharmony_ci  let reverseGeocodeRequest:geoLocationManager.ReverseGeoCodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1};
1570e41f4b71Sopenharmony_ci  try {
1571e41f4b71Sopenharmony_ci      geoLocationManager.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
1572e41f4b71Sopenharmony_ci          if (err) {
1573e41f4b71Sopenharmony_ci              console.error('getAddressesFromLocation: err=' + JSON.stringify(err));
1574e41f4b71Sopenharmony_ci          }
1575e41f4b71Sopenharmony_ci          if (data) {
1576e41f4b71Sopenharmony_ci              console.log('getAddressesFromLocation: data=' + JSON.stringify(data));
1577e41f4b71Sopenharmony_ci          }
1578e41f4b71Sopenharmony_ci      });
1579e41f4b71Sopenharmony_ci  } catch (err) {
1580e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1581e41f4b71Sopenharmony_ci  }
1582e41f4b71Sopenharmony_ci  ```
1583e41f4b71Sopenharmony_ci
1584e41f4b71Sopenharmony_ci
1585e41f4b71Sopenharmony_ci## geoLocationManager.getAddressesFromLocation
1586e41f4b71Sopenharmony_ci
1587e41f4b71Sopenharmony_cigetAddressesFromLocation(request: ReverseGeoCodeRequest): Promise&lt;Array&lt;GeoAddress&gt;&gt;;
1588e41f4b71Sopenharmony_ci
1589e41f4b71Sopenharmony_ciConverts coordinates into geographic descriptions through reverse geocoding. This API uses a promise to return the result. 
1590e41f4b71Sopenharmony_ci
1591e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
1592e41f4b71Sopenharmony_ci
1593e41f4b71Sopenharmony_ci**Parameters**
1594e41f4b71Sopenharmony_ci
1595e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1596e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1597e41f4b71Sopenharmony_ci  | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.|
1598e41f4b71Sopenharmony_ci
1599e41f4b71Sopenharmony_ci**Return value**
1600e41f4b71Sopenharmony_ci
1601e41f4b71Sopenharmony_ci  | Type| Description|
1602e41f4b71Sopenharmony_ci  | -------- | -------- |
1603e41f4b71Sopenharmony_ci  | Promise&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | Promise used to return the result.|
1604e41f4b71Sopenharmony_ci
1605e41f4b71Sopenharmony_ci**Error codes**
1606e41f4b71Sopenharmony_ci
1607e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1608e41f4b71Sopenharmony_ci
1609e41f4b71Sopenharmony_ci| ID| Error Message|
1610e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1611e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1612e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities.          |
1613e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1614e41f4b71Sopenharmony_ci|3301300 | Reverse geocoding query failed.   |
1615e41f4b71Sopenharmony_ci
1616e41f4b71Sopenharmony_ci**Example**
1617e41f4b71Sopenharmony_ci
1618e41f4b71Sopenharmony_ci  ```ts
1619e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1620e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1621e41f4b71Sopenharmony_ci  let reverseGeocodeRequest:geoLocationManager.ReverseGeoCodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1};
1622e41f4b71Sopenharmony_ci  try {
1623e41f4b71Sopenharmony_ci      geoLocationManager.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
1624e41f4b71Sopenharmony_ci          console.log('getAddressesFromLocation: ' + JSON.stringify(data));
1625e41f4b71Sopenharmony_ci      })
1626e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
1627e41f4b71Sopenharmony_ci          console.error('promise, getAddressesFromLocation: error=' + JSON.stringify(error));
1628e41f4b71Sopenharmony_ci      });
1629e41f4b71Sopenharmony_ci  } catch (err) {
1630e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1631e41f4b71Sopenharmony_ci  }
1632e41f4b71Sopenharmony_ci  ```
1633e41f4b71Sopenharmony_ci
1634e41f4b71Sopenharmony_ci
1635e41f4b71Sopenharmony_ci## geoLocationManager.getAddressesFromLocationName
1636e41f4b71Sopenharmony_ci
1637e41f4b71Sopenharmony_cigetAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback&lt;Array&lt;GeoAddress&gt;&gt;): void
1638e41f4b71Sopenharmony_ci
1639e41f4b71Sopenharmony_ciConverts geographic descriptions into coordinates through geocoding. This API uses an asynchronous callback to return the result. 
1640e41f4b71Sopenharmony_ci
1641e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
1642e41f4b71Sopenharmony_ci
1643e41f4b71Sopenharmony_ci**Parameters**
1644e41f4b71Sopenharmony_ci
1645e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1646e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1647e41f4b71Sopenharmony_ci  | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.|
1648e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | Yes| Callback used to return the result.|
1649e41f4b71Sopenharmony_ci
1650e41f4b71Sopenharmony_ci**Error codes**
1651e41f4b71Sopenharmony_ci
1652e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1653e41f4b71Sopenharmony_ci
1654e41f4b71Sopenharmony_ci| ID| Error Message|
1655e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1656e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1657e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocationName} due to limited device capabilities.          |
1658e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1659e41f4b71Sopenharmony_ci|3301400 | Geocoding query failed.   |
1660e41f4b71Sopenharmony_ci
1661e41f4b71Sopenharmony_ci**Example**
1662e41f4b71Sopenharmony_ci
1663e41f4b71Sopenharmony_ci  ```ts
1664e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1665e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1666e41f4b71Sopenharmony_ci  let geocodeRequest:geoLocationManager.GeoCodeRequest = {"description": "No. xx, xx Road, Pudong District, Shanghai", "maxItems": 1};
1667e41f4b71Sopenharmony_ci  try {
1668e41f4b71Sopenharmony_ci      geoLocationManager.getAddressesFromLocationName(geocodeRequest, (err, data) => {
1669e41f4b71Sopenharmony_ci          if (err) {
1670e41f4b71Sopenharmony_ci              console.error('getAddressesFromLocationName: err=' + JSON.stringify(err));
1671e41f4b71Sopenharmony_ci          }
1672e41f4b71Sopenharmony_ci          if (data) {
1673e41f4b71Sopenharmony_ci              console.log('getAddressesFromLocationName: data=' + JSON.stringify(data));
1674e41f4b71Sopenharmony_ci          }
1675e41f4b71Sopenharmony_ci      });
1676e41f4b71Sopenharmony_ci  } catch (err) {
1677e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1678e41f4b71Sopenharmony_ci  }
1679e41f4b71Sopenharmony_ci  ```
1680e41f4b71Sopenharmony_ci
1681e41f4b71Sopenharmony_ci
1682e41f4b71Sopenharmony_ci## geoLocationManager.getAddressesFromLocationName
1683e41f4b71Sopenharmony_ci
1684e41f4b71Sopenharmony_cigetAddressesFromLocationName(request: GeoCodeRequest): Promise&lt;Array&lt;GeoAddress&gt;&gt;
1685e41f4b71Sopenharmony_ci
1686e41f4b71Sopenharmony_ciConverts geographic descriptions into coordinates through geocoding. This API uses an a promise to return the result. 
1687e41f4b71Sopenharmony_ci
1688e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
1689e41f4b71Sopenharmony_ci
1690e41f4b71Sopenharmony_ci**Parameters**
1691e41f4b71Sopenharmony_ci
1692e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1693e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1694e41f4b71Sopenharmony_ci  | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.|
1695e41f4b71Sopenharmony_ci
1696e41f4b71Sopenharmony_ci**Return value**
1697e41f4b71Sopenharmony_ci
1698e41f4b71Sopenharmony_ci  | Type| Description|
1699e41f4b71Sopenharmony_ci  | -------- | -------- |
1700e41f4b71Sopenharmony_ci  | Promise&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | Promise used to return the result.|
1701e41f4b71Sopenharmony_ci
1702e41f4b71Sopenharmony_ci**Error codes**
1703e41f4b71Sopenharmony_ci
1704e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1705e41f4b71Sopenharmony_ci
1706e41f4b71Sopenharmony_ci| ID| Error Message|
1707e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1708e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1709e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocationName} due to limited device capabilities.          |
1710e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1711e41f4b71Sopenharmony_ci|3301400 | Geocoding query failed.   |
1712e41f4b71Sopenharmony_ci
1713e41f4b71Sopenharmony_ci**Example**
1714e41f4b71Sopenharmony_ci
1715e41f4b71Sopenharmony_ci  ```ts
1716e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1717e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1718e41f4b71Sopenharmony_ci  let geocodeRequest:geoLocationManager.GeoCodeRequest = {"description": "No. xx, xx Road, Pudong District, Shanghai", "maxItems": 1};
1719e41f4b71Sopenharmony_ci  try {
1720e41f4b71Sopenharmony_ci      geoLocationManager.getAddressesFromLocationName(geocodeRequest).then((result) => {
1721e41f4b71Sopenharmony_ci          console.log('getAddressesFromLocationName: ' + JSON.stringify(result));
1722e41f4b71Sopenharmony_ci      })
1723e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
1724e41f4b71Sopenharmony_ci          console.error('promise, getAddressesFromLocationName: error=' + JSON.stringify(error));
1725e41f4b71Sopenharmony_ci      });
1726e41f4b71Sopenharmony_ci  } catch (err) {
1727e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1728e41f4b71Sopenharmony_ci  }
1729e41f4b71Sopenharmony_ci  ```
1730e41f4b71Sopenharmony_ci
1731e41f4b71Sopenharmony_ci## geoLocationManager.isGeocoderAvailable
1732e41f4b71Sopenharmony_ci
1733e41f4b71Sopenharmony_ciisGeocoderAvailable(): boolean;
1734e41f4b71Sopenharmony_ci
1735e41f4b71Sopenharmony_ciChecks whether the geocoding and reverse geocoding services are available.
1736e41f4b71Sopenharmony_ci
1737e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geocoder
1738e41f4b71Sopenharmony_ci
1739e41f4b71Sopenharmony_ci**Return value**
1740e41f4b71Sopenharmony_ci
1741e41f4b71Sopenharmony_ci  | Type| Description|
1742e41f4b71Sopenharmony_ci  | -------- | -------- |
1743e41f4b71Sopenharmony_ci  | boolean | **true**: The geocoding and reverse geocoding services are available.<br>**false**: The geocoding and reverse geocoding services are unavailable.|
1744e41f4b71Sopenharmony_ci
1745e41f4b71Sopenharmony_ci**Error codes**
1746e41f4b71Sopenharmony_ci
1747e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1748e41f4b71Sopenharmony_ci
1749e41f4b71Sopenharmony_ci| ID| Error Message|
1750e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1751e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.isGeocoderAvailable} due to limited device capabilities.          |
1752e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1753e41f4b71Sopenharmony_ci
1754e41f4b71Sopenharmony_ci**Example**
1755e41f4b71Sopenharmony_ci
1756e41f4b71Sopenharmony_ci  ```ts
1757e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1758e41f4b71Sopenharmony_ci  try {
1759e41f4b71Sopenharmony_ci      let isAvailable = geoLocationManager.isGeocoderAvailable();
1760e41f4b71Sopenharmony_ci  } catch (err) {
1761e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1762e41f4b71Sopenharmony_ci  }
1763e41f4b71Sopenharmony_ci  ```
1764e41f4b71Sopenharmony_ci
1765e41f4b71Sopenharmony_ci
1766e41f4b71Sopenharmony_ci## geoLocationManager.getCachedGnssLocationsSize
1767e41f4b71Sopenharmony_ci
1768e41f4b71Sopenharmony_cigetCachedGnssLocationsSize(callback: AsyncCallback&lt;number&gt;): void;
1769e41f4b71Sopenharmony_ci
1770e41f4b71Sopenharmony_ciObtains the number of cached GNSS locations. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported. This API uses an asynchronous callback to return the result.
1771e41f4b71Sopenharmony_ci
1772e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1773e41f4b71Sopenharmony_ci
1774e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
1775e41f4b71Sopenharmony_ci
1776e41f4b71Sopenharmony_ci**Parameters**
1777e41f4b71Sopenharmony_ci
1778e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1779e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1780e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the result.|
1781e41f4b71Sopenharmony_ci
1782e41f4b71Sopenharmony_ci**Error codes**
1783e41f4b71Sopenharmony_ci
1784e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1785e41f4b71Sopenharmony_ci
1786e41f4b71Sopenharmony_ci| ID| Error Message|
1787e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1788e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1789e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1790e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCachedGnssLocationsSize} due to limited device capabilities.          |
1791e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1792e41f4b71Sopenharmony_ci|3301100 | The location switch is off.   |
1793e41f4b71Sopenharmony_ci
1794e41f4b71Sopenharmony_ci**Example**
1795e41f4b71Sopenharmony_ci
1796e41f4b71Sopenharmony_ci  ```ts
1797e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1798e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1799e41f4b71Sopenharmony_ci  try {
1800e41f4b71Sopenharmony_ci      geoLocationManager.getCachedGnssLocationsSize((err, size) => {
1801e41f4b71Sopenharmony_ci          if (err) {
1802e41f4b71Sopenharmony_ci              console.error('getCachedGnssLocationsSize: err=' + JSON.stringify(err));
1803e41f4b71Sopenharmony_ci          }
1804e41f4b71Sopenharmony_ci          if (size) {
1805e41f4b71Sopenharmony_ci              console.log('getCachedGnssLocationsSize: size=' + JSON.stringify(size));
1806e41f4b71Sopenharmony_ci          }
1807e41f4b71Sopenharmony_ci      });
1808e41f4b71Sopenharmony_ci  } catch (err) {
1809e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1810e41f4b71Sopenharmony_ci  }
1811e41f4b71Sopenharmony_ci  ```
1812e41f4b71Sopenharmony_ci
1813e41f4b71Sopenharmony_ci
1814e41f4b71Sopenharmony_ci## geoLocationManager.getCachedGnssLocationsSize
1815e41f4b71Sopenharmony_ci
1816e41f4b71Sopenharmony_cigetCachedGnssLocationsSize(): Promise&lt;number&gt;;
1817e41f4b71Sopenharmony_ci
1818e41f4b71Sopenharmony_ciObtains the number of cached GNSS locations. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported. This API uses a promise to return the result.
1819e41f4b71Sopenharmony_ci
1820e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1821e41f4b71Sopenharmony_ci
1822e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
1823e41f4b71Sopenharmony_ci
1824e41f4b71Sopenharmony_ci**Return value**
1825e41f4b71Sopenharmony_ci
1826e41f4b71Sopenharmony_ci  | Type| Description|
1827e41f4b71Sopenharmony_ci  | -------- | -------- |
1828e41f4b71Sopenharmony_ci  | Promise&lt;number&gt; | Promise used to return the result.|
1829e41f4b71Sopenharmony_ci
1830e41f4b71Sopenharmony_ci**Error codes**
1831e41f4b71Sopenharmony_ci
1832e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1833e41f4b71Sopenharmony_ci
1834e41f4b71Sopenharmony_ci| ID| Error Message|
1835e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1836e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1837e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCachedGnssLocationsSize} due to limited device capabilities.          |
1838e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1839e41f4b71Sopenharmony_ci|3301100 | The location switch is off.   |
1840e41f4b71Sopenharmony_ci
1841e41f4b71Sopenharmony_ci**Example**
1842e41f4b71Sopenharmony_ci
1843e41f4b71Sopenharmony_ci  ```ts
1844e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1845e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1846e41f4b71Sopenharmony_ci  try {
1847e41f4b71Sopenharmony_ci      geoLocationManager.getCachedGnssLocationsSize().then((result) => {
1848e41f4b71Sopenharmony_ci          console.log('promise, getCachedGnssLocationsSize: ' + JSON.stringify(result));
1849e41f4b71Sopenharmony_ci      }) 
1850e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
1851e41f4b71Sopenharmony_ci          console.error('promise, getCachedGnssLocationsSize: error=' + JSON.stringify(error));
1852e41f4b71Sopenharmony_ci      });
1853e41f4b71Sopenharmony_ci  } catch (err) {
1854e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1855e41f4b71Sopenharmony_ci  }
1856e41f4b71Sopenharmony_ci  ```
1857e41f4b71Sopenharmony_ci
1858e41f4b71Sopenharmony_ci
1859e41f4b71Sopenharmony_ci## geoLocationManager.flushCachedGnssLocations
1860e41f4b71Sopenharmony_ci
1861e41f4b71Sopenharmony_ciflushCachedGnssLocations(callback: AsyncCallback&lt;void&gt;): void;
1862e41f4b71Sopenharmony_ci
1863e41f4b71Sopenharmony_ciObtains all cached GNSS locations and clears the GNSS cache queue. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported. This API uses an asynchronous callback to return the result.
1864e41f4b71Sopenharmony_ci
1865e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1866e41f4b71Sopenharmony_ci
1867e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
1868e41f4b71Sopenharmony_ci
1869e41f4b71Sopenharmony_ci**Parameters**
1870e41f4b71Sopenharmony_ci
1871e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1872e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1873e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object.|
1874e41f4b71Sopenharmony_ci
1875e41f4b71Sopenharmony_ci**Error codes**
1876e41f4b71Sopenharmony_ci
1877e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1878e41f4b71Sopenharmony_ci
1879e41f4b71Sopenharmony_ci| ID| Error Message|
1880e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1881e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1882e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1883e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.flushCachedGnssLocations} due to limited device capabilities.          |
1884e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1885e41f4b71Sopenharmony_ci|3301100 | The location switch is off.   |
1886e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.   |
1887e41f4b71Sopenharmony_ci
1888e41f4b71Sopenharmony_ci**Example**
1889e41f4b71Sopenharmony_ci
1890e41f4b71Sopenharmony_ci  ```ts
1891e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1892e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1893e41f4b71Sopenharmony_ci  try {
1894e41f4b71Sopenharmony_ci      geoLocationManager.flushCachedGnssLocations((err) => {
1895e41f4b71Sopenharmony_ci          if (err) {
1896e41f4b71Sopenharmony_ci              console.error('flushCachedGnssLocations: err=' + JSON.stringify(err));
1897e41f4b71Sopenharmony_ci          }
1898e41f4b71Sopenharmony_ci      });
1899e41f4b71Sopenharmony_ci  } catch (err) {
1900e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1901e41f4b71Sopenharmony_ci  }
1902e41f4b71Sopenharmony_ci  ```
1903e41f4b71Sopenharmony_ci
1904e41f4b71Sopenharmony_ci
1905e41f4b71Sopenharmony_ci## geoLocationManager.flushCachedGnssLocations
1906e41f4b71Sopenharmony_ci
1907e41f4b71Sopenharmony_ciflushCachedGnssLocations(): Promise&lt;void&gt;;
1908e41f4b71Sopenharmony_ci
1909e41f4b71Sopenharmony_ciObtains all cached GNSS locations and clears the GNSS cache queue. This API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported. This API uses a promise to return the result.
1910e41f4b71Sopenharmony_ci
1911e41f4b71Sopenharmony_ci**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
1912e41f4b71Sopenharmony_ci
1913e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Gnss
1914e41f4b71Sopenharmony_ci
1915e41f4b71Sopenharmony_ci**Return value**
1916e41f4b71Sopenharmony_ci
1917e41f4b71Sopenharmony_ci  | Type| Description|
1918e41f4b71Sopenharmony_ci  | -------- | -------- |
1919e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that returns no value.|
1920e41f4b71Sopenharmony_ci
1921e41f4b71Sopenharmony_ci**Error codes**
1922e41f4b71Sopenharmony_ci
1923e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1924e41f4b71Sopenharmony_ci
1925e41f4b71Sopenharmony_ci| ID| Error Message|
1926e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1927e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
1928e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.flushCachedGnssLocations} due to limited device capabilities.          |
1929e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1930e41f4b71Sopenharmony_ci|3301100 | The location switch is off.   |
1931e41f4b71Sopenharmony_ci|3301200 | Failed to obtain the geographical location.   |
1932e41f4b71Sopenharmony_ci
1933e41f4b71Sopenharmony_ci**Example**
1934e41f4b71Sopenharmony_ci
1935e41f4b71Sopenharmony_ci  ```ts
1936e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1937e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1938e41f4b71Sopenharmony_ci  try {
1939e41f4b71Sopenharmony_ci      geoLocationManager.flushCachedGnssLocations().then(() => {
1940e41f4b71Sopenharmony_ci          console.log('promise, flushCachedGnssLocations success');
1941e41f4b71Sopenharmony_ci      })
1942e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
1943e41f4b71Sopenharmony_ci          console.error('promise, flushCachedGnssLocations: error=' + JSON.stringify(error));
1944e41f4b71Sopenharmony_ci      });
1945e41f4b71Sopenharmony_ci  } catch (err) {
1946e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1947e41f4b71Sopenharmony_ci  }
1948e41f4b71Sopenharmony_ci  ```
1949e41f4b71Sopenharmony_ci
1950e41f4b71Sopenharmony_ci
1951e41f4b71Sopenharmony_ci## geoLocationManager.sendCommand
1952e41f4b71Sopenharmony_ci
1953e41f4b71Sopenharmony_cisendCommand(command: LocationCommand, callback: AsyncCallback&lt;void&gt;): void;
1954e41f4b71Sopenharmony_ci
1955e41f4b71Sopenharmony_ciSends an extended command to the location subsystem. This API uses an asynchronous callback to return the result.
1956e41f4b71Sopenharmony_ci
1957e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
1958e41f4b71Sopenharmony_ci
1959e41f4b71Sopenharmony_ci**Parameters**
1960e41f4b71Sopenharmony_ci
1961e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
1962e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
1963e41f4b71Sopenharmony_ci  | command |  [LocationCommand](#locationcommand) | Yes| Extended command (string) to be sent.|
1964e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
1965e41f4b71Sopenharmony_ci
1966e41f4b71Sopenharmony_ci**Error codes**
1967e41f4b71Sopenharmony_ci
1968e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
1969e41f4b71Sopenharmony_ci
1970e41f4b71Sopenharmony_ci| ID| Error Message|
1971e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
1972e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
1973e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.sendCommand} due to limited device capabilities.          |
1974e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.  |
1975e41f4b71Sopenharmony_ci
1976e41f4b71Sopenharmony_ci**Example**
1977e41f4b71Sopenharmony_ci
1978e41f4b71Sopenharmony_ci  ```ts
1979e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
1980e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
1981e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.LocationCommand = {'scenario': 0x301, 'command': "command_1"};
1982e41f4b71Sopenharmony_ci  try {
1983e41f4b71Sopenharmony_ci      geoLocationManager.sendCommand(requestInfo, (err) => {
1984e41f4b71Sopenharmony_ci          if (err) {
1985e41f4b71Sopenharmony_ci              console.error('sendCommand: err=' + JSON.stringify(err));
1986e41f4b71Sopenharmony_ci          }
1987e41f4b71Sopenharmony_ci      });
1988e41f4b71Sopenharmony_ci  } catch (err) {
1989e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
1990e41f4b71Sopenharmony_ci  }
1991e41f4b71Sopenharmony_ci  ```
1992e41f4b71Sopenharmony_ci
1993e41f4b71Sopenharmony_ci
1994e41f4b71Sopenharmony_ci## geoLocationManager.sendCommand
1995e41f4b71Sopenharmony_ci
1996e41f4b71Sopenharmony_cisendCommand(command: LocationCommand): Promise&lt;void&gt;;
1997e41f4b71Sopenharmony_ci
1998e41f4b71Sopenharmony_ciSends an extended command to the location subsystem. This API uses a promise to return the result.
1999e41f4b71Sopenharmony_ci
2000e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
2001e41f4b71Sopenharmony_ci
2002e41f4b71Sopenharmony_ci**Parameters**
2003e41f4b71Sopenharmony_ci
2004e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
2005e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
2006e41f4b71Sopenharmony_ci  | command | [LocationCommand](#locationcommand) | Yes| Extended command (string) to be sent.|
2007e41f4b71Sopenharmony_ci
2008e41f4b71Sopenharmony_ci**Return value**
2009e41f4b71Sopenharmony_ci
2010e41f4b71Sopenharmony_ci  | Type| Description|
2011e41f4b71Sopenharmony_ci  | -------- | -------- |
2012e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that returns no value.|
2013e41f4b71Sopenharmony_ci
2014e41f4b71Sopenharmony_ci**Error codes**
2015e41f4b71Sopenharmony_ci
2016e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
2017e41f4b71Sopenharmony_ci
2018e41f4b71Sopenharmony_ci| ID| Error Message|
2019e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
2020e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
2021e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.sendCommand} due to limited device capabilities.          |
2022e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
2023e41f4b71Sopenharmony_ci
2024e41f4b71Sopenharmony_ci**Example**
2025e41f4b71Sopenharmony_ci
2026e41f4b71Sopenharmony_ci  ```ts
2027e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
2028e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
2029e41f4b71Sopenharmony_ci  let requestInfo:geoLocationManager.LocationCommand = {'scenario': 0x301, 'command': "command_1"};
2030e41f4b71Sopenharmony_ci  try {
2031e41f4b71Sopenharmony_ci      geoLocationManager.sendCommand(requestInfo).then(() => {
2032e41f4b71Sopenharmony_ci          console.log('promise, sendCommand success');
2033e41f4b71Sopenharmony_ci      })  
2034e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
2035e41f4b71Sopenharmony_ci          console.error('promise, sendCommand: error=' + JSON.stringify(error));
2036e41f4b71Sopenharmony_ci      });
2037e41f4b71Sopenharmony_ci  } catch (err) {
2038e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
2039e41f4b71Sopenharmony_ci  }
2040e41f4b71Sopenharmony_ci  ```
2041e41f4b71Sopenharmony_ci
2042e41f4b71Sopenharmony_ci
2043e41f4b71Sopenharmony_ci## geoLocationManager.getCountryCode
2044e41f4b71Sopenharmony_ci
2045e41f4b71Sopenharmony_cigetCountryCode(callback: AsyncCallback&lt;CountryCode&gt;): void;
2046e41f4b71Sopenharmony_ci
2047e41f4b71Sopenharmony_ciObtains the current country code. This API uses an asynchronous callback to return the result.
2048e41f4b71Sopenharmony_ci
2049e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
2050e41f4b71Sopenharmony_ci
2051e41f4b71Sopenharmony_ci**Parameters**
2052e41f4b71Sopenharmony_ci
2053e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
2054e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
2055e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;[CountryCode](#countrycode)&gt; | Yes| Callback used to return the result.|
2056e41f4b71Sopenharmony_ci
2057e41f4b71Sopenharmony_ci**Error codes**
2058e41f4b71Sopenharmony_ci
2059e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
2060e41f4b71Sopenharmony_ci
2061e41f4b71Sopenharmony_ci| ID| Error Message|
2062e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
2063e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
2064e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCountryCode} due to limited device capabilities.          |
2065e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
2066e41f4b71Sopenharmony_ci|3301500 | Failed to query the area information.|
2067e41f4b71Sopenharmony_ci
2068e41f4b71Sopenharmony_ci**Example**
2069e41f4b71Sopenharmony_ci
2070e41f4b71Sopenharmony_ci  ```ts
2071e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
2072e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
2073e41f4b71Sopenharmony_ci  try {
2074e41f4b71Sopenharmony_ci      geoLocationManager.getCountryCode((err, result) => {
2075e41f4b71Sopenharmony_ci          if (err) {
2076e41f4b71Sopenharmony_ci              console.error('getCountryCode: err=' + JSON.stringify(err));
2077e41f4b71Sopenharmony_ci          }
2078e41f4b71Sopenharmony_ci          if (result) {
2079e41f4b71Sopenharmony_ci              console.log('getCountryCode: result=' + JSON.stringify(result));
2080e41f4b71Sopenharmony_ci          }
2081e41f4b71Sopenharmony_ci      });
2082e41f4b71Sopenharmony_ci  } catch (err) {
2083e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
2084e41f4b71Sopenharmony_ci  }
2085e41f4b71Sopenharmony_ci  ```
2086e41f4b71Sopenharmony_ci
2087e41f4b71Sopenharmony_ci
2088e41f4b71Sopenharmony_ci## geoLocationManager.getCountryCode
2089e41f4b71Sopenharmony_ci
2090e41f4b71Sopenharmony_cigetCountryCode(): Promise&lt;CountryCode&gt;;
2091e41f4b71Sopenharmony_ci
2092e41f4b71Sopenharmony_ciObtains the current country code. This API uses a promise to return the result.
2093e41f4b71Sopenharmony_ci
2094e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Core
2095e41f4b71Sopenharmony_ci
2096e41f4b71Sopenharmony_ci**Return value**
2097e41f4b71Sopenharmony_ci
2098e41f4b71Sopenharmony_ci  | Type| Description|
2099e41f4b71Sopenharmony_ci  | -------- | -------- |
2100e41f4b71Sopenharmony_ci  | Promise&lt;[CountryCode](#countrycode)&gt; | Promise used to return the result.|
2101e41f4b71Sopenharmony_ci
2102e41f4b71Sopenharmony_ci**Error codes**
2103e41f4b71Sopenharmony_ci
2104e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
2105e41f4b71Sopenharmony_ci
2106e41f4b71Sopenharmony_ci| ID| Error Message|
2107e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
2108e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getCountryCode} due to limited device capabilities.          |
2109e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.                                           |
2110e41f4b71Sopenharmony_ci|3301500 | Failed to query the area information.|
2111e41f4b71Sopenharmony_ci
2112e41f4b71Sopenharmony_ci**Example**
2113e41f4b71Sopenharmony_ci
2114e41f4b71Sopenharmony_ci  ```ts
2115e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
2116e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
2117e41f4b71Sopenharmony_ci  try {
2118e41f4b71Sopenharmony_ci      geoLocationManager.getCountryCode()
2119e41f4b71Sopenharmony_ci      .then((result) => {
2120e41f4b71Sopenharmony_ci          console.log('promise, getCountryCode: result=' + JSON.stringify(result));
2121e41f4b71Sopenharmony_ci      })
2122e41f4b71Sopenharmony_ci      .catch((error:BusinessError) => {
2123e41f4b71Sopenharmony_ci          console.error('promise, getCountryCode: error=' + JSON.stringify(error));
2124e41f4b71Sopenharmony_ci      });
2125e41f4b71Sopenharmony_ci  } catch (err) {
2126e41f4b71Sopenharmony_ci      console.error("errCode:" + JSON.stringify(err));
2127e41f4b71Sopenharmony_ci  }
2128e41f4b71Sopenharmony_ci  ```
2129e41f4b71Sopenharmony_ci
2130e41f4b71Sopenharmony_ci## geoLocationManager.addGnssGeofence<sup>12+</sup>
2131e41f4b71Sopenharmony_ci
2132e41f4b71Sopenharmony_ciaddGnssGeofence(fenceRequest: GnssGeofenceRequest): Promise&lt;number&gt;;
2133e41f4b71Sopenharmony_ci
2134e41f4b71Sopenharmony_ciAdds a GNSS geofence and subscribes to geofence transition events. This API uses a promise to return the result.
2135e41f4b71Sopenharmony_ci
2136e41f4b71Sopenharmony_ciThe application can pass a callback to [GnssGeofenceRequest](#gnssgeofencerequest12) to receive geofence transition events. It can also pass [NotificationRequest](../apis-notification-kit/js-apis-notification.md#notificationrequest) so that a notification is displayed when a geofence transition event occurs.
2137e41f4b71Sopenharmony_ci
2138e41f4b71Sopenharmony_ciThis API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported.
2139e41f4b71Sopenharmony_ci
2140e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
2141e41f4b71Sopenharmony_ci
2142e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
2143e41f4b71Sopenharmony_ci
2144e41f4b71Sopenharmony_ci**Parameters**
2145e41f4b71Sopenharmony_ci
2146e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
2147e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
2148e41f4b71Sopenharmony_ci  | fenceRequest | [GnssGeofenceRequest](#gnssgeofencerequest12) | Yes| Geofence request.<br>It includes the geofence information, list of geofence transition events and notifications, and callback used to receive geofence transition events.|
2149e41f4b71Sopenharmony_ci
2150e41f4b71Sopenharmony_ci**Return value**
2151e41f4b71Sopenharmony_ci
2152e41f4b71Sopenharmony_ci  | Type| Description|
2153e41f4b71Sopenharmony_ci  | -------- | -------- |
2154e41f4b71Sopenharmony_ci  | Promise&lt;number&gt; | Promise used to return the result.|
2155e41f4b71Sopenharmony_ci
2156e41f4b71Sopenharmony_ci**Error codes**
2157e41f4b71Sopenharmony_ci
2158e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
2159e41f4b71Sopenharmony_ci
2160e41f4b71Sopenharmony_ci| ID| Error Message|
2161e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
2162e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
2163e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
2164e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.addGnssGeofence} due to limited device capabilities.          |
2165e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable.|
2166e41f4b71Sopenharmony_ci|3301100  | The location switch is off.|
2167e41f4b71Sopenharmony_ci|3301601   | The number of geofences exceeds the maximum.|
2168e41f4b71Sopenharmony_ci
2169e41f4b71Sopenharmony_ci**Example**
2170e41f4b71Sopenharmony_ci
2171e41f4b71Sopenharmony_ci  ```ts
2172e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
2173e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
2174e41f4b71Sopenharmony_ci  import { notificationManager } from '@kit.NotificationKit';
2175e41f4b71Sopenharmony_ci  // Create a geofence.
2176e41f4b71Sopenharmony_ci  let geofence: geoLocationManager.Geofence = {
2177e41f4b71Sopenharmony_ci    "latitude": 34.12, "longitude": 124.11, "radius": 10000.0, "expiration": 10000.0
2178e41f4b71Sopenharmony_ci  }
2179e41f4b71Sopenharmony_ci  // Specify the types of geofence transition events to listen for. Geofence entry and exit events are used as an example.
2180e41f4b71Sopenharmony_ci  let transitionStatusList: Array<geoLocationManager.GeofenceTransitionEvent> = [
2181e41f4b71Sopenharmony_ci    geoLocationManager.GeofenceTransitionEvent.GEOFENCE_TRANSITION_EVENT_ENTER,
2182e41f4b71Sopenharmony_ci    geoLocationManager.GeofenceTransitionEvent.GEOFENCE_TRANSITION_EVENT_EXIT,
2183e41f4b71Sopenharmony_ci  ];
2184e41f4b71Sopenharmony_ci  // Create a notification object for GEOFENCE_TRANSITION_EVENT_ENTER.
2185e41f4b71Sopenharmony_ci  let notificationRequest1: notificationManager.NotificationRequest = {
2186e41f4b71Sopenharmony_ci    id: 1,
2187e41f4b71Sopenharmony_ci    content: {
2188e41f4b71Sopenharmony_ci      notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
2189e41f4b71Sopenharmony_ci      normal: {
2190e41f4b71Sopenharmony_ci        title: "Geofence Notification",
2191e41f4b71Sopenharmony_ci        text: "Geofence Entry",
2192e41f4b71Sopenharmony_ci        additionalText: ""
2193e41f4b71Sopenharmony_ci      }
2194e41f4b71Sopenharmony_ci    }
2195e41f4b71Sopenharmony_ci  };
2196e41f4b71Sopenharmony_ci  // Create a notification object for GEOFENCE_TRANSITION_EVENT_EXIT.
2197e41f4b71Sopenharmony_ci  let notificationRequest2: notificationManager.NotificationRequest = {
2198e41f4b71Sopenharmony_ci    id: 2,
2199e41f4b71Sopenharmony_ci    content: {
2200e41f4b71Sopenharmony_ci      notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
2201e41f4b71Sopenharmony_ci      normal: {
2202e41f4b71Sopenharmony_ci        title: "Geofence Notification",
2203e41f4b71Sopenharmony_ci        text:'Geofence Exit',
2204e41f4b71Sopenharmony_ci        additionalText: ""
2205e41f4b71Sopenharmony_ci      }
2206e41f4b71Sopenharmony_ci    }
2207e41f4b71Sopenharmony_ci  };
2208e41f4b71Sopenharmony_ci  // Save the created notification objects to Array in the same sequence as in transitionStatusList.
2209e41f4b71Sopenharmony_ci  let notificationRequestList: Array<notificationManager.NotificationRequest> =
2210e41f4b71Sopenharmony_ci    [notificationRequest1, notificationRequest2];
2211e41f4b71Sopenharmony_ci  // Construct a gnssGeofenceRequest object.
2212e41f4b71Sopenharmony_ci  let gnssGeofenceRequest: geoLocationManager.GnssGeofenceRequest = {
2213e41f4b71Sopenharmony_ci    // Geofence attributes, including the circle center and radius.
2214e41f4b71Sopenharmony_ci    geofence: geofence,
2215e41f4b71Sopenharmony_ci    // Specify the types of geofence transition events to listen for.
2216e41f4b71Sopenharmony_ci    monitorTransitionEvents: transitionStatusList,
2217e41f4b71Sopenharmony_ci    // Specify the notification objects for geofence transition events. This parameter is optional.
2218e41f4b71Sopenharmony_ci    notifications: notificationRequestList,
2219e41f4b71Sopenharmony_ci    // Specify the callback used to receive geofence transition events.
2220e41f4b71Sopenharmony_ci    geofenceTransitionCallback: (err : BusinessError, transition : geoLocationManager.GeofenceTransition) => {
2221e41f4b71Sopenharmony_ci      if (err) {
2222e41f4b71Sopenharmony_ci        console.error('geofenceTransitionCallback: err=' + JSON.stringify(err));
2223e41f4b71Sopenharmony_ci      }
2224e41f4b71Sopenharmony_ci      if (transition) {
2225e41f4b71Sopenharmony_ci        console.log("GeofenceTransition: %{public}s", JSON.stringify(transition));
2226e41f4b71Sopenharmony_ci    }
2227e41f4b71Sopenharmony_ci    }
2228e41f4b71Sopenharmony_ci  }
2229e41f4b71Sopenharmony_ci  try {
2230e41f4b71Sopenharmony_ci    // Add a geofence.
2231e41f4b71Sopenharmony_ci    geoLocationManager.addGnssGeofence(gnssGeofenceRequest).then((id) => {
2232e41f4b71Sopenharmony_ci      // Obtain the geofence ID after the geofence is successfully added.
2233e41f4b71Sopenharmony_ci      console.log("addGnssGeofence success, fence id: " + id);
2234e41f4b71Sopenharmony_ci      let fenceId = id;
2235e41f4b71Sopenharmony_ci    }).catch((err: BusinessError) => {
2236e41f4b71Sopenharmony_ci      console.error("addGnssGeofence failed, promise errCode:" + (err as BusinessError).code + 
2237e41f4b71Sopenharmony_ci        ",errMessage:" + (err as BusinessError).message);
2238e41f4b71Sopenharmony_ci    });
2239e41f4b71Sopenharmony_ci  } catch(error) {
2240e41f4b71Sopenharmony_ci      console.error("addGnssGeofence failed, err:" + JSON.stringify(error));
2241e41f4b71Sopenharmony_ci  }
2242e41f4b71Sopenharmony_ci  ```
2243e41f4b71Sopenharmony_ci  
2244e41f4b71Sopenharmony_ci
2245e41f4b71Sopenharmony_ci## geoLocationManager.removeGnssGeofence<sup>12+</sup>
2246e41f4b71Sopenharmony_ci
2247e41f4b71Sopenharmony_ciremoveGnssGeofence(geofenceId: number): Promise&lt;void&gt;;
2248e41f4b71Sopenharmony_ci
2249e41f4b71Sopenharmony_ciRemoves a GNSS geofence and unsubscribes from geofence transition events. This API uses a promise to return the result.
2250e41f4b71Sopenharmony_ci
2251e41f4b71Sopenharmony_ciThis API is supported only by certain GNSS chip models. If the required chip model is not available, error code 801 (Capability not supported) will be reported.
2252e41f4b71Sopenharmony_ci
2253e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
2254e41f4b71Sopenharmony_ci
2255e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
2256e41f4b71Sopenharmony_ci
2257e41f4b71Sopenharmony_ci**Parameters**
2258e41f4b71Sopenharmony_ci
2259e41f4b71Sopenharmony_ci  | Name| Type| Mandatory| Description|
2260e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
2261e41f4b71Sopenharmony_ci  | geofenceId | number | Yes| GNSS geofence ID.|
2262e41f4b71Sopenharmony_ci
2263e41f4b71Sopenharmony_ci**Return value**
2264e41f4b71Sopenharmony_ci
2265e41f4b71Sopenharmony_ci  | Type| Description|
2266e41f4b71Sopenharmony_ci  | -------- | -------- |
2267e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that that returns no value.|
2268e41f4b71Sopenharmony_ci
2269e41f4b71Sopenharmony_ci**Error codes**
2270e41f4b71Sopenharmony_ci
2271e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
2272e41f4b71Sopenharmony_ci
2273e41f4b71Sopenharmony_ci| ID| Error Message|
2274e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
2275e41f4b71Sopenharmony_ci|201 | Permission verification failed. The application does not have the permission required to call the API.                 |
2276e41f4b71Sopenharmony_ci|401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.                 |
2277e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.removeGnssGeofence} due to limited device capabilities.          |
2278e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable. |
2279e41f4b71Sopenharmony_ci|3301602 | Failed to delete a geofence due to an incorrect ID. |
2280e41f4b71Sopenharmony_ci
2281e41f4b71Sopenharmony_ci**Example**
2282e41f4b71Sopenharmony_ci
2283e41f4b71Sopenharmony_ci  ```ts
2284e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
2285e41f4b71Sopenharmony_ci  import { BusinessError } from '@kit.BasicServicesKit'
2286e41f4b71Sopenharmony_ci  // fenceId is obtained after geoLocationManager.addGnssGeofence is successfully executed.
2287e41f4b71Sopenharmony_ci  let fenceId = 1;
2288e41f4b71Sopenharmony_ci  try {
2289e41f4b71Sopenharmony_ci    geoLocationManager.removeGnssGeofence(fenceId).then(() => {
2290e41f4b71Sopenharmony_ci      console.log("removeGnssGeofence success fenceId:" + fenceId);
2291e41f4b71Sopenharmony_ci    }).catch((error : BusinessError) => {
2292e41f4b71Sopenharmony_ci      console.error("removeGnssGeofence: error=" + JSON.stringify(error));
2293e41f4b71Sopenharmony_ci    });
2294e41f4b71Sopenharmony_ci  } catch(error) {
2295e41f4b71Sopenharmony_ci    console.error("removeGnssGeofence: error=" + JSON.stringify(error));
2296e41f4b71Sopenharmony_ci  }
2297e41f4b71Sopenharmony_ci  ```
2298e41f4b71Sopenharmony_ci
2299e41f4b71Sopenharmony_ci
2300e41f4b71Sopenharmony_ci## geoLocationManager.getGeofenceSupportedCoordTypes<sup>12+</sup>
2301e41f4b71Sopenharmony_ci
2302e41f4b71Sopenharmony_cigetGeofenceSupportedCoordTypes(): Array&lt;CoordinateSystemType&gt;;
2303e41f4b71Sopenharmony_ci
2304e41f4b71Sopenharmony_ciObtains the list of supported coordinate systems.
2305e41f4b71Sopenharmony_ci
2306e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Location.Location.Geofence
2307e41f4b71Sopenharmony_ci
2308e41f4b71Sopenharmony_ci**Return value**
2309e41f4b71Sopenharmony_ci
2310e41f4b71Sopenharmony_ci  | Type| Description|
2311e41f4b71Sopenharmony_ci  | -------- | -------- |
2312e41f4b71Sopenharmony_ci  | Array&lt;[CoordinateSystemType](#coordinatesystemtype12)&gt; | List of supported coordinate systems.|
2313e41f4b71Sopenharmony_ci
2314e41f4b71Sopenharmony_ci**Error codes**
2315e41f4b71Sopenharmony_ci
2316e41f4b71Sopenharmony_ciFor details about the error codes, see [Location Error Codes]](errorcode-geoLocationManager.md).
2317e41f4b71Sopenharmony_ci
2318e41f4b71Sopenharmony_ci| ID| Error Message|
2319e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- |
2320e41f4b71Sopenharmony_ci|801 | Capability not supported. Failed to call ${geoLocationManager.getGeofenceSupportedCoordTypes} due to limited device capabilities.          |
2321e41f4b71Sopenharmony_ci|3301000 | The location service is unavailable. |
2322e41f4b71Sopenharmony_ci
2323e41f4b71Sopenharmony_ci**Example**
2324e41f4b71Sopenharmony_ci
2325e41f4b71Sopenharmony_ci  ```ts
2326e41f4b71Sopenharmony_ci  import { geoLocationManager } from '@kit.LocationKit';
2327e41f4b71Sopenharmony_ci  try {
2328e41f4b71Sopenharmony_ci    let supportedCoordTypes: Array<geoLocationManager.CoordinateSystemType> = geoLocationManager.getGeofenceSupportedCoordTypes();
2329e41f4b71Sopenharmony_ci    console.log("getGeofenceSupportedCoordTypes return:" + JSON.stringify(supportedCoordTypes));
2330e41f4b71Sopenharmony_ci  } catch(error) {
2331e41f4b71Sopenharmony_ci    console.error("getGeofenceSupportedCoordTypes: error=" + JSON.stringify(error));
2332e41f4b71Sopenharmony_ci  }
2333e41f4b71Sopenharmony_ci  ```
2334