diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index 0d008c7f831661dcc9d49bb8a8cf3273ede1a361..f510e03e7807b1b29f5a3dbb24653292315b0bf7 100644 --- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -1,4 +1,4 @@ -# Ability Access Control +# Ability Access Control > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-geolocation.md b/en/application-dev/reference/apis/js-apis-geolocation.md index 2c6fbbdfac2693968b4d4f5aaabebe2ba940791b..7d4694bfa7cac837438ecd4f38a9f414316e92e0 100644 --- a/en/application-dev/reference/apis/js-apis-geolocation.md +++ b/en/application-dev/reference/apis/js-apis-geolocation.md @@ -1,7 +1,7 @@ -# Geolocation - New +# Geolocation -> ![icon-note.gif](public_sys-resources/icon-note.gif) **Noteļ¼š** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -12,26 +12,23 @@ import geolocation from '@ohos.geolocation'; ``` - -## Required Permissions - -ohos.permission.LOCATION - -ohos.permission.LOCATION_IN_BACKGROUND - - ## geolocation.on('locationChange') on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>) : void Registers a listener for location changes with a location request initiated. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **locationChange** indicates a location change event. | - | request | LocationRequest | Yes | Location request. | - | callback | Callback<[Location](#location)> | Yes | Callback used to return the location change event. | + | type | string | Yes| Event type. The value **locationChange** indicates a location change event.| + | request | LocationRequest | Yes| Location request.| + | callback | Callback<[Location](#location)> | Yes| Callback used to return the location change event.| + - Example @@ -50,11 +47,16 @@ off(type: 'locationChange', callback?: Callback<Location>) : void Unregisters the listener for location changes with the corresponding location request deleted. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **locationChange** indicates a location change event. | - | callback | Callback<[Location](#location)> | No | Callback used to return the location change event. | + | type | string | Yes| Event type. The value **locationChange** indicates a location change event.| + | callback | Callback<[Location](#location)> | No| Callback used to return the location change event.| + - Example @@ -74,11 +76,16 @@ on(type: 'locationServiceState', callback: Callback<boolean>) : void Registers a listener for location service status change events. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **locationServiceState** indicates a location service status change event. | - | callback | Callback<boolean> | Yes | Callback used to return the location service status change event. | + | type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.| + | callback | Callback<boolean> | Yes| Callback used to return the location service status change event.| + - Example @@ -96,11 +103,16 @@ off(type: 'locationServiceState', callback?: Callback<boolean>) : void; Unregisters the listener for location service status change events. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **locationServiceState** indicates a location service status change event. | - | callback | Callback<boolean> | No | Callback used to return the location service status change event. | + | type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.| + | callback | Callback<boolean> | No| Callback used to return the location service status change event.| + - Example @@ -113,18 +125,23 @@ Unregisters the listener for location service status change events. ``` -## geolocation.on('cachedGnssLocationsReporting') +## geolocation.on('cachedGnssLocationsReporting')8+ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>) : void; Registers a listener for cached GNSS location reports. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations. | - | request | CachedGnssLocationsRequest | Yes | Request for reporting cached GNSS location. | - | callback | Callback<boolean> | Yes | Callback used to return cached GNSS locations. | + | type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.| + | request | CachedGnssLocationsRequest | Yes| Request for reporting cached GNSS location.| + | callback | Callback<boolean> | Yes| Callback used to return cached GNSS locations.| + - Example @@ -137,17 +154,22 @@ Registers a listener for cached GNSS location reports. ``` -## geolocation.off('cachedGnssLocationsReporting') +## geolocation.off('cachedGnssLocationsReporting')8+ off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>) : void; Unregisters the listener for cached GNSS location reports. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations. | - | callback | Callback<boolean> | No | Callback used to return cached GNSS locations. | + | type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.| + | callback | Callback<boolean> | No| Callback used to return cached GNSS locations.| + - Example @@ -161,17 +183,22 @@ Unregisters the listener for cached GNSS location reports. ``` -## geolocation.on('gnssStatusChange') +## geolocation.on('gnssStatusChange')8+ on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>) : void; Registers a listener for GNSS satellite status change events. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **gnssStatusChange** indicates a GNSS satellite status change. | - | callback | Callback<SatelliteStatusInfo> | Yes | Callback used to return GNSS satellite status changes. | + | type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.| + | callback | Callback<SatelliteStatusInfo> | Yes| Callback used to return GNSS satellite status changes.| + - Example @@ -183,17 +210,21 @@ Registers a listener for GNSS satellite status change events. ``` -## geolocation.off('gnssStatusChange') +## geolocation.off('gnssStatusChange')8+ off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>) : void; Unregisters the listener for GNSS satellite status change events. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **gnssStatusChange** indicates a GNSS satellite status change. | - | callback | Callback<SatelliteStatusInfo> | No | Callback used to return GNSS satellite status changes. | + | type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.| + | callback | Callback<SatelliteStatusInfo> | No| Callback used to return GNSS satellite status changes.| - Example @@ -206,17 +237,22 @@ Unregisters the listener for GNSS satellite status change events. ``` -## geolocation.on('nmeaMessageChange') +## geolocation.on('nmeaMessageChange')8+ on(type: 'nmeaMessageChange', callback: Callback<string>) : void; Registers a listener for GNSS NMEA message change events. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change. | - | callback | Callback<string> | Yes | Callback used to return GNSS NMEA message changes. | + | type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.| + | callback | Callback<string> | Yes| Callback used to return GNSS NMEA message changes.| + - Example @@ -228,17 +264,22 @@ Registers a listener for GNSS NMEA message change events. ``` -## geolocation.off('nmeaMessageChange') +## geolocation.off('nmeaMessageChange')8+ off(type: 'nmeaMessageChange', callback?: Callback<string>) : void; Unregisters the listener for GNSS NMEA message change events. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change. | - | callback | Callback<string> | No | Callback used to return GNSS NMEA message changes. | + | type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.| + | callback | Callback<string> | No| Callback used to return GNSS NMEA message changes.| + - Example @@ -251,18 +292,23 @@ Unregisters the listener for GNSS NMEA message change events. ``` -## geolocation.on('fenceStatusChange') +## geolocation.on('fenceStatusChange')8+ on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; Registers a listener for status change events of the specified geofence. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geofence + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **fenceStatusChange** indicates a geofence status change. | - | request | GeofenceRequest | Yes | Geofencing request. | - | want | WantAgent | Yes | **WantAgent** used to return geofence (entrance or exit) events. | + | type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.| + | request | GeofenceRequest | Yes| Geofencing request.| + | want | WantAgent | Yes| **WantAgent** used to return geofence (entrance or exit) events.| + - Example @@ -313,18 +359,22 @@ Registers a listener for status change events of the specified geofence. ``` -## geolocation.off('fenceStatusChange') +## geolocation.off('fenceStatusChange')8+ off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; Unregisters the listener for status change events of the specified geofence. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geofence + - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes | Event type. The value **fenceStatusChange** indicates a geofence status change. | - | request | GeofenceRequest | Yes | Geofencing request. | - | want | WantAgent | Yes | **WantAgent** used to return geofence (entrance or exit) events. | + | type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.| + | request | GeofenceRequest | Yes| Geofencing request.| + | want | WantAgent | Yes| **WantAgent** used to return geofence (entrance or exit) events.| - Example @@ -381,14 +431,17 @@ Unregisters the listener for status change events of the specified geofence. getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>) : void -Obtains the current location. This method uses an asynchronous callback to return the result. +Obtains the current location. This API uses an asynchronous callback to return the result. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | request | [CurrentLocationRequest](#currentlocationrequest) | No | Location request. | - | callback | AsyncCallback<[Location](#location)> | Yes | Callback used to return the current location. | + | request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.| + | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the current location.| - Example @@ -407,18 +460,22 @@ Obtains the current location. This method uses an asynchronous callback to retur getCurrentLocation(request?: CurrentLocationRequest) : Promise<Location> -Obtains the current location. This method uses a promise to return the result. +Obtains the current location. This API uses a promise to return the result. + +**Permission required**: ohos.permission.LOCATION +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | request | [CurrentLocationRequest](#currentlocationrequest) | No | Location request. | + | request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.| -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<[Location](#location)> | Promise used to return the current location. | + | Promise<[Location](#location)> | Promise used to return the current location.| + - Example @@ -434,12 +491,17 @@ Obtains the current location. This method uses a promise to return the result. getLastLocation(callback: AsyncCallback<Location>) : void -Obtains the previous location. This method uses an asynchronous callback to return the result. +Obtains the previous location. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[Location](#location)> | Yes | Callback used to return the previous location. | + | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the previous location.| + - Example @@ -454,12 +516,17 @@ Obtains the previous location. This method uses an asynchronous callback to retu getLastLocation() : Promise<Location> -Obtains the previous location. This method uses a promise to return the result. +Obtains the previous location. This API uses a promise to return the result. -- Return values - | Name | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +- Return value + | Name| Description| | -------- | -------- | - | Promise<[Location](#location)> | Promise used to return the previous location. | + | Promise<[Location](#location)> | Promise used to return the previous location.| + - Example @@ -475,13 +542,17 @@ Obtains the previous location. This method uses a promise to return the result. isLocationEnabled(callback: AsyncCallback<boolean>) : void -Checks whether the location service is enabled. This method uses an asynchronous callback to return the result. +Checks whether the location service is enabled. This API uses an asynchronous callback to return the result. +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the location service status. | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| + - Example @@ -496,12 +567,16 @@ Checks whether the location service is enabled. This method uses an asynchronous isLocationEnabled() : Promise<boolean> -Checks whether the location service is enabled. This method uses a promise to return the result. +Checks whether the location service is enabled. This API uses a promise to return the result. + +**Permission required**: ohos.permission.LOCATION -- Return values - | Name | Description | +**System capability**: SystemCapability.Location.Location.Core + +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return the location service status. | + | Promise<boolean> | Promise used to return the location service status.| - Example @@ -517,13 +592,17 @@ Checks whether the location service is enabled. This method uses a promise to re requestEnableLocation(callback: AsyncCallback<boolean>) : void -Requests to enable the location service. This method uses an asynchronous callback to return the result. +Requests to enable the location service. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.LOCATION +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the location service status. | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| + - Example @@ -538,12 +617,17 @@ Requests to enable the location service. This method uses an asynchronous callba requestEnableLocation() : Promise<boolean> -Requests to enable the location service. This method uses a promise to return the result. +Requests to enable the location service. This API uses a promise to return the result. -- Return values - | Name | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return the location service status. | + | Promise<boolean> | Promise used to return the location service status.| + - Example @@ -554,16 +638,127 @@ Requests to enable the location service. This method uses a promise to return th ``` +## geolocation.enableLocation + +enableLocation(callback: AsyncCallback<boolean>) : void; + +Enables the location service. This API uses an asynchronous callback to return the result. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| + + +- Example + + ``` + geolocation.enableLocation((err, data) => { + console.log('enableLocation: ' + err + " data: " + data); + }); + ``` + + +## geolocation.enableLocation + +enableLocation() : Promise<boolean> + +Enables the location service. This API uses a promise to return the result. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +- Return value + | Name| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the location service status.| + + +- Example + + ``` + geolocation.enableLocation().then((result) => { + console.log('promise, enableLocation: ' + result); + }); + ``` + +## geolocation.disableLocation + +disableLocation(callback: AsyncCallback<boolean>) : void; + +Enables the location service. This API uses an asynchronous callback to return the result. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| + + +- Example + + ``` + geolocation.disableLocation((err, data) => { + console.log('disableLocation: ' + err + " data: " + data); + }); + ``` + + +## geolocation.disableLocation + +disableLocation() : Promise<boolean> + +Enables the location service. This API uses a promise to return the result. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +- Return value + | Name| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the location service status.| + + +- Example + + ``` + geolocation.disableLocation().then((result) => { + console.log('promise, disableLocation: ' + result); + }); + ``` + ## geolocation.isGeoServiceAvailable isGeoServiceAvailable(callback: AsyncCallback<boolean>) : void -Checks whether the (reverse) geocoding service is available. This method uses an asynchronous callback to return the result. +Checks whether the (reverse) geocoding service is available. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the (reverse) geocoding service status. | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the (reverse) geocoding service status.| + - Example @@ -578,12 +773,17 @@ Checks whether the (reverse) geocoding service is available. This method uses an isGeoServiceAvailable() : Promise<boolean> -Checks whether the (reverse) geocoding service is available. This method uses a promise to return the result. +Checks whether the (reverse) geocoding service is available. This API uses a promise to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return the (reverse) geocoding service status. | + | Promise<boolean> | Promise used to return the (reverse) geocoding service status.| + - Example @@ -599,13 +799,17 @@ Checks whether the (reverse) geocoding service is available. This method uses a getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void -Converts coordinates into geographic description through reverse geocoding. This method uses an asynchronous callback to return the result. +Converts coordinates into geographic description through reverse geocoding. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes | Reverse geocoding request. | - | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes | Callback used to return the reverse geocoding result. | + | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.| + | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the reverse geocoding result.| - Example @@ -621,17 +825,21 @@ Converts coordinates into geographic description through reverse geocoding. This getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise<Array<GeoAddress>>; -Converts coordinates into geographic description through reverse geocoding. This method uses a promise to return the result. +Converts coordinates into geographic description through reverse geocoding. This API uses a promise to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes | Reverse geocoding request. | + | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.| -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<Array<[GeoAddress](#geoaddress)>> | Promise used to return the reverse geocoding result. | + | Promise<Array<[GeoAddress](#geoaddress)>> | Promise used to return the reverse geocoding result.| - Example @@ -647,13 +855,18 @@ Converts coordinates into geographic description through reverse geocoding. This getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void -Converts geographic description into coordinates through geocoding. This method uses an asynchronous callback to return the result. +Converts geographic description into coordinates through geocoding. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | request | [GeoCodeRequest](#geocoderequest) | Yes | Geocoding request. | - | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes | Callback used to return the geocoding result. | + | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.| + | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the geocoding result.| + - Example @@ -669,17 +882,21 @@ Converts geographic description into coordinates through geocoding. This method getAddressesFromLocationName(request: GeoCodeRequest) : Promise<Array<GeoAddress>> -Converts geographic description into coordinates through geocoding. This method uses a promise to return the result. +Converts geographic description into coordinates through geocoding. This API uses a promise to return the result. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | request | [GeoCodeRequest](#geocoderequest) | Yes | Geocoding request. | + | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.| -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<Array<[GeoAddress](#geoaddress)>> | Promise used to return the geocoding result. | + | Promise<Array<[GeoAddress](#geoaddress)>> | Callback used to return the geocoding result.| - Example @@ -692,16 +909,20 @@ Converts geographic description into coordinates through geocoding. This method -## geolocation.getCachedGnssLocationsSize +## geolocation.getCachedGnssLocationsSize8+ getCachedGnssLocationsSize(callback: AsyncCallback<number>) : void; -Obtains the number of cached GNSS locations. +Obtains the number of cached GNSS locations. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<number> | Yes | Callback used to return the number of cached GNSS locations. | + | callback | AsyncCallback<number> | Yes| Callback used to return the number of cached GNSS locations. | - Example @@ -712,16 +933,20 @@ Obtains the number of cached GNSS locations. ``` -## geolocation.getCachedGnssLocationsSize +## geolocation.getCachedGnssLocationsSize8+ getCachedGnssLocationsSize() : Promise<number>; -Obtains the number of cached GNSS locations. +Obtains the number of cached GNSS locations. -- Return values - | Name | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + +- Return value + | Name| Description| | -------- | -------- | - | Promise<number> | Promise used to return the number of cached GNSS locations. | + | Promise<number> | Promise used to return the number of cached GNSS locations.| - Example @@ -732,16 +957,20 @@ Obtains the number of cached GNSS locations. ``` -## geolocation.flushCachedGnssLocations +## geolocation.flushCachedGnssLocations8+ flushCachedGnssLocations(callback: AsyncCallback<boolean>) : void; -Obtains all cached GNSS locations and clears the GNSS cache queue. +Obtains all cached GNSS locations and clears the GNSS cache queue. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the operation result. | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| - Example @@ -752,16 +981,20 @@ Obtains all cached GNSS locations and clears the GNSS cache queue. ``` -## geolocation.flushCachedGnssLocations +## geolocation.flushCachedGnssLocations8+ flushCachedGnssLocations() : Promise<boolean>; -Obtains all cached GNSS locations and clears the GNSS cache queue. +Obtains all cached GNSS locations and clears the GNSS cache queue. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return the operation result. | + | Promise<boolean> | Promise used to return the operation result.| - Example @@ -772,17 +1005,21 @@ Obtains all cached GNSS locations and clears the GNSS cache queue. ``` -## geolocation.sendCommand +## geolocation.sendCommand8+ sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>) : void; -Sends an extended command to the location subsystem. This function can only be called by system applications. +Sends an extended command to the location subsystem. This API can only be called by system applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | command | LocationCommand | Yes | Extended command (string) to be sent. | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the operation result. | + | command | LocationCommand | Yes| Extended command (string) to be sent.| + | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| - Example @@ -794,21 +1031,25 @@ Sends an extended command to the location subsystem. This function can only be c ``` -## geolocation.sendCommand +## geolocation.sendCommand8+ sendCommand(command: LocationCommand) : Promise<boolean>; -Sends extended commands to the location subsystem. This function can only be called by system applications. +Sends an extended command to the location subsystem. This API can only be called by system applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | command | LocationCommand | Yes | Extended command (string) to be sent. | + | command | LocationCommand | Yes| Extended command (string) to be sent.| -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Callback used to return the operation result. | + | Promise<boolean> | Callback used to return the operation result.| - Example @@ -820,17 +1061,23 @@ Sends extended commands to the location subsystem. This function can only be cal ``` -## geolocation.isLocationPrivacyConfirmed +## geolocation.isLocationPrivacyConfirmed8+ isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback<boolean>) : void; -Checks whether a user agrees with the privacy statement of the location service. This function can only be called by system applications. +Checks whether a user agrees with the privacy statement of the location service. This API can only be called by system applications. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | LocationPrivacyType | Yes | Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service. | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the result, which indicates whether the user agrees with the privacy statement. | + | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| - Example @@ -841,21 +1088,27 @@ Checks whether a user agrees with the privacy statement of the location service. ``` -## geolocation.isLocationPrivacyConfirmed +## geolocation.isLocationPrivacyConfirmed8+ isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise<boolean>; -Checks whether a user agrees with the privacy statement of the location service. This function can only be called by system applications. +Checks whether a user agrees with the privacy statement of the location service. This API can only be called by system applications. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | LocationPrivacyType | Yes | Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service. | + | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return the result, which indicates whether the user agrees with the privacy statement. | + | Promise<boolean> | Callback used to return the result, which indicates whether the user agrees with the privacy statement.| - Example @@ -866,18 +1119,24 @@ Checks whether a user agrees with the privacy statement of the location service. ``` -## geolocation.setLocationPrivacyConfirmStatus +## geolocation.setLocationPrivacyConfirmStatus8+ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<boolean>) : void; -Sets the user confirmation status for the privacy statement of the location service. This function can only be called by system applications. +Sets the user confirmation status for the privacy statement of the location service. This API can only be called by system applications. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | LocationPrivacyType | Yes | Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service. | - | isConfirmed | boolean | Yes | Whether the user agrees with the privacy statement of the location service. | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the operation result. | + | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| + | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| + | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| - Example @@ -888,22 +1147,28 @@ Sets the user confirmation status for the privacy statement of the location serv ``` -## geolocation.setLocationPrivacyConfirmStatus +## geolocation.setLocationPrivacyConfirmStatus8+ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean) : Promise<boolean>; -Sets the user confirmation status for the privacy statement of the location service. This function can only be called by system applications. +Sets the user confirmation status for the privacy statement of the location service. This API can only be called by system applications. + +This is a system API and cannot be called by third-party applications. + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core - Parameters - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | LocationPrivacyType | Yes | Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service. | - | isConfirmed | boolean | Yes | Whether the user agrees with the privacy statement of the location service. | + | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| + | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| -- Return values - | Name | Description | +- Return value + | Name| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return the operation result. | + | Promise<boolean> | Callback used to return the operation result.| - Example @@ -919,201 +1184,262 @@ Sets the user confirmation status for the privacy statement of the location serv Sets the priority of the location request. - | Name | Default Value | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Default Value| Description| | -------- | -------- | -------- | -| UNSET | 0x200 | Priority unspecified. | -| ACCURACY | 0x201 | Location accuracy. | -| LOW_POWER | 0x202 | Power efficiency. | -| FIRST_FIX | 0x203 | Fast location. Use this option if you want to obtain a location as fast as possible. | +| UNSET | 0x200 | Priority unspecified.| +| ACCURACY | 0x201 | Location accuracy.| +| LOW_POWER | 0x202 | Power efficiency.| +| FIRST_FIX | 0x203 | Fast location. Use this option if you want to obtain a location as fast as possible.| ## LocationRequestScenario Sets the scenario of the location request. - | Name | Default Value | Description | + +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Default Value| Description| | -------- | -------- | -------- | -| UNSET | 0x300 | Scenario unspecified. | -| NAVIGATION | 0x301 | Navigation. | -| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking. | -| CAR_HAILING | 0x303 | Ride hailing. | -| DAILY_LIFE_SERVICE | 0x304 | Daily life services. | -| 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. | +| UNSET | 0x300 | Scenario unspecified.| +| NAVIGATION | 0x301 | Navigation.| +| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking.| +| CAR_HAILING | 0x303 | Ride hailing.| +| DAILY_LIFE_SERVICE | 0x304 | Daily life services.| +| 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.| ## GeoLocationErrorCode Enumerates error codes of the location service. - | Name | Default Value | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Default Value| Description| | -------- | -------- | -------- | -| INPUT_PARAMS_ERROR | 101 | Incorrect input parameters. | -| REVERSE_GEOCODE_ERROR | 102 | Failed to call the reverse geocoding API. | -| GEOCODE_ERROR | 103 | Failed to call the geocoding API. | -| LOCATOR_ERROR | 104 | Failed to obtain the location. | -| LOCATION_SWITCH_ERROR | 105 | Failed to change the location service switch. | -| LAST_KNOWN_LOCATION_ERROR | 106 | Failed to obtain the previous location. | -| LOCATION_REQUEST_TIMEOUT_ERROR | 107 | Failed to obtain the location within the specified time. | +| INPUT_PARAMS_ERROR | 101 | Incorrect input parameters.| +| REVERSE_GEOCODE_ERROR | 102 | Failed to call the reverse geocoding API.| +| GEOCODE_ERROR | 103 | Failed to call the geocoding API.| +| LOCATOR_ERROR | 104 | Failed to obtain the location.| +| LOCATION_SWITCH_ERROR | 105 | Failed to change the location service switch.| +| LAST_KNOWN_LOCATION_ERROR | 106 | Failed to obtain the previous location.| +| LOCATION_REQUEST_TIMEOUT_ERROR | 107 | Failed to obtain the location within the specified time.| ## ReverseGeoCodeRequest Defines a reverse geocoding request. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| locale | string | No | Language used for the location description. **zh** indicates Chinese, and **en** indicates English. | -| latitude | number | Yes | Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. | -| longitude | number | Yes | Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . | -| maxItems | number | No | Maximum number of location records to be returned. | +| locale | string | No| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.| +| latitude | number | Yes| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude.| +| longitude | number | Yes| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude .| +| maxItems | number | No| Maximum number of location records to be returned.| ## GeoCodeRequest Defines a geocoding request. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| locale | string | No | Language used for the location description. **zh** indicates Chinese, and **en** indicates English. | -| description | number | Yes | Location description, for example, **No. xx, xx Road, Pudong New District, Shanghai**. | -| maxItems | number | No | Maximum number of location records to be returned. | -| minLatitude | number | No | Minimum latitude. This parameter is used with **minLongitude**, **maxLatitude**, and **maxLongitude** to specify the latitude and longitude ranges. | -| minLongitude | number | No | Minimum longitude. | -| maxLatitude | number | No | Maximum latitude. | -| maxLongitude | number | No | Maximum longitude. | +| locale | string | No| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.| +| description | number | Yes| Location description, for example, No. xx, xx Road, Pudong New District, Shanghai.| +| maxItems | number | No| Maximum number of location records to be returned.| +| minLatitude | number | No| Minimum latitude. This parameter is used with minLongitude, maxLatitude, and maxLongitude to specify the latitude and longitude ranges.| +| minLongitude | number | No| Minimum longitude.| +| maxLatitude | number | No| Maximum latitude.| +| maxLongitude | number | No| Maximum longitude.| ## GeoAddress Defines a geographic location. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geocoder + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| latitude | number | No | Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. | -| longitude | number | No | Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . | -| locale | string | No | Language used for the location description. **zh** indicates Chinese, and **en** indicates English. | -| placeName | string | No | Landmark of the location. | -| countryCode | string | No | Country code. | -| countryName | string | No | Country name. | -| administrativeArea | string | No | Administrative region name. | -| subAdministrativeArea | string | No | Sub-administrative region name. | -| locality | string | No | Locality information. | -| subLocality | string | No | Sub-locality information. | -| roadName | string | No | Road name. | -| subRoadName | string | No | Auxiliary road information. | -| premises | string | No | House information. | -| postalCode | string | No | Postal code. | -| phoneNumber | string | No | Phone number. | -| addressUrl | string | No | Website URL. | -| descriptions | Array<string> | No | Additional description. | -| descriptionsSize | number | No | Total number of additional descriptions. | +| latitude | number | No| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude.| +| longitude | number | No| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude .| +| locale | string | No| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.| +| placeName | string | No| Landmark of the location.| +| countryCode | string | No| Country code.| +| countryName | string | No| Country name.| +| administrativeArea | string | No| Administrative region name.| +| subAdministrativeArea | string | No| Sub-administrative region name.| +| locality | string | No| Locality information. | +| subLocality | string | No| Sub-locality information. | +| roadName | string | No| Road name.| +| subRoadName | string | No| Auxiliary road information.| +| premises | string | No| House information.| +| postalCode | string | No| Postal code.| +| phoneNumber | string | No| Phone number.| +| addressUrl | string | No| Website URL.| +| descriptions | Array<string> | No| Additional description.| +| descriptionsSize | number | No| Total number of additional descriptions.| ## LocationRequest Defines a location request. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| priority | [LocationRequestPriority](#locationrequestpriority) | No | Priority of the location request. | -| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes | Scenario of the location request. | -| timeInterval | number | No | Time interval at which location information is reported. | -| distanceInterval | number | No | Distance interval at which location information is reported. | -| maxAccuracy | number | No | Location accuracy. | +| priority | [LocationRequestPriority](#locationrequestpriority) | No| Priority of the location request.| +| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Scenario of the location request.| +| timeInterval | number | No| Time interval at which location information is reported.| +| distanceInterval | number | No| Distance interval at which location information is reported.| +| maxAccuracy | number | No| Location accuracy.| ## CurrentLocationRequest Defines the current location request. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| priority | [LocationRequestPriority](#locationrequestpriority) | No | Priority of the location request. | -| scenario | [LocationRequestScenario](#locationrequestscenario) | No | Scenario of the location request. | -| maxAccuracy | number | No | Location accuracy, in meters. | -| timeoutMs | number | No | Timeout duration, in milliseconds. The minimum value is **1000**. | +| priority | [LocationRequestPriority](#locationrequestpriority) | No| Priority of the location request.| +| scenario | [LocationRequestScenario](#locationrequestscenario) | No| Scenario of the location request.| +| maxAccuracy | number | No| Location accuracy, in meters.| +| timeoutMs | number | No| Timeout duration, in milliseconds. The minimum value is 1000.| -## SatelliteStatusInfo +## SatelliteStatusInfo8+ Defines the satellite status information. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| satellitesNumber | number | Yes | Number of satellites. | -| satelliteIds | Array<number> | Yes | Array of satellite IDs. | -| carrierToNoiseDensitys | Array<number> | Yes | Carrier-to-noise density ratio, that is, cn0. | -| altitudes | Array<number> | Yes | Altitude information. | -| azimuths | Array<number> | Yes | Azimuth information. | -| carrierFrequencies | Array<number> | Yes | Carrier frequency. | +| satellitesNumber | number | Yes| Number of satellites.| +| satelliteIds | Array<number> | Yes| Array of satellite IDs.| +| carrierToNoiseDensitys | Array<number> | Yes| Carrier-to-noise density ratio, that is, **cn0**.| +| altitudes | Array<number> | Yes| Altitude information.| +| azimuths | Array<number> | Yes| Azimuth information.| +| carrierFrequencies | Array<number> | Yes| Carrier frequency.| -## CachedGnssLocationsRequest +## CachedGnssLocationsRequest8+ Represents a request for reporting cached GNSS locations. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Gnss + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| reportingPeriodSec | number | Yes | Interval for reporting the cached GNSS locations, in milliseconds. | -| wakeUpCacheQueueFull | boolean | Yes | **true**: reports the cached GNSS locations to the application when the cache queue is full.
**false**: discards the cached GNSS locations when the cache queue is full. | +| reportingPeriodSec | number | Yes| Interval for reporting the cached GNSS locations, in milliseconds.| +| wakeUpCacheQueueFull | boolean | Yes| **true**: reports the cached GNSS locations to the application when the cache queue is full.
**false**: discards the cached GNSS locations when the cache queue is full.| -## Geofence +## Geofence8+ Defines a GNSS geofence. Currently, only circular geofences are supported. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geofence + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| latitude | number | Yes | Latitude information. | -| longitude | number | Yes | Longitude information. | -| radius | number | Yes | Radius of a circular geofence. | -| expiration | number | Yes | Expiration period of a geofence, in milliseconds. | +| latitude | number | Yes| Latitude information.| +| longitude | number | Yes| Longitude information.| +| radius | number | Yes| Radius of a circular geofence.| +| expiration | number | Yes| Expiration period of a geofence, in milliseconds.| -## GeofenceRequest +## GeofenceRequest8+ Represents a GNSS geofencing request. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Geofence + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| priority | LocationRequestPriority | Yes | Priority of the location information. | -| scenario | LocationRequestScenario | Yes | Location scenario. | -| geofence | Geofence | Yes | Geofence information. | +| priority | LocationRequestPriority | Yes| Priority of the location information.| +| scenario | LocationRequestScenario | Yes| Location scenario.| +| geofence | Geofence | Yes| Geofence information.| -## LocationPrivacyType +## LocationPrivacyType8+ Defines the privacy statement type. - | Name | Default Value | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Default Value| Description| | -------- | -------- | -------- | -| OTHERS | 0 | Other scenarios. | -| STARTUP | 1 | Privacy statement displayed in the startup wizard. | -| CORE_LOCATION | 2 | Privacy statement displayed when enabling the location service. | +| OTHERS | 0 | Other scenarios.| +| STARTUP | 1 | Privacy statement displayed in the startup wizard.| +| CORE_LOCATION | 2 | Privacy statement displayed when enabling the location service.| -## LocationCommand +## LocationCommand8+ Defines an extended command. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| scenario | LocationRequestScenario | Yes | Location scenario. | -| command | string | Yes | Extended command, in the string format. | +| scenario | LocationRequestScenario | Yes| Location scenario.| +| command | string | Yes| Extended command, in the string format.| ## Location Defines a location. - | Name | Type | Mandatory | Description | +**Permission required**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Core + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| latitude | number | Yes | Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. | -| longitude | number | Yes | Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . | -| altitude | number | Yes | Location altitude, in meters. | -| accuracy | number | Yes | Location accuracy, in meters. | -| speed | number | Yes | Speed, in m/s. | -| timeStamp | number | Yes | Location timestamp in the UTC format. | -| direction | number | Yes | Direction information. | -| timeSinceBoot | number | Yes | Location timestamp since boot. | -| additions | Array<string> | No | Additional description. | -| additionSize | number | No | Number of additional descriptions. | +| latitude | number | Yes| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude.| +| longitude | number | Yes| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude .| +| altitude | number | Yes| Location altitude, in meters.| +| accuracy | number | Yes| Location accuracy, in meters.| +| speed | number | Yes| Speed, in m/s.| +| timeStamp | number | Yes| Location timestamp in the UTC format.| +| direction | number | Yes| Direction information.| +| timeSinceBoot | number | Yes| Location timestamp since boot.| +| additions | Array<string> | No| Additional information.| +| additionSize | number | No| Number of additional descriptions.|