From 1b692283e81d5b1ac2ce1b6c9c869bcf2037c30c Mon Sep 17 00:00:00 2001 From: wanzixuan Date: Tue, 22 Jul 2025 19:56:38 +0800 Subject: [PATCH] Modify overload functions for interface Signed-off-by: wanzixuan --- api/@ohos.geoLocationManager.d.ts | 640 +++++++++++++++++++++++++++--- 1 file changed, 583 insertions(+), 57 deletions(-) diff --git a/api/@ohos.geoLocationManager.d.ts b/api/@ohos.geoLocationManager.d.ts index 74511e841d..24d3be8c9d 100644 --- a/api/@ohos.geoLocationManager.d.ts +++ b/api/@ohos.geoLocationManager.d.ts @@ -45,6 +45,62 @@ import { NotificationRequest } from './notification/notificationRequest'; * @arkts 1.1&1.2 */ declare namespace geoLocationManager { + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onLocationChange, + onLocationError, + onLocationEnabledChange, + onCachedGnssLocationsChange, + onSatelliteStatusChange, + onNmeaMessage, + onGnssFenceStatusChange, + onCountryCodeChange, + onLocatingRequiredDataChange, + onLocationIconStatusChange, + onBluetoothScanResultChange + }; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { + offLocationChange, + offLocationError, + offLocationEnabledChange, + offCachedGnssLocationsChange, + offSatelliteStatusChange, + offNmeaMessage, + offGnssFenceStatusChange, + offCountryCodeChange, + offLocatingRequiredDataChange, + offLocationIconStatusChange, + offBluetoothScanResultChange + }; + + /** + * Subscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { LocationRequest | ContinuousLocationRequest } request - Indicates the location request parameters. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function onLocationChange(type: 'locationChange', request: LocationRequest | ContinuousLocationRequest, + callback: Callback): void; + /** * Subscribe location changed. * @@ -109,12 +165,29 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Core * @atomicservice - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 + * @arkts 1.1 */ function on(type: 'locationChange', request: LocationRequest | ContinuousLocationRequest, callback: Callback): void; + /** + * Unsubscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function offLocationChange(type: 'locationChange', callback?: Callback): void; + /** * Unsubscribe location changed. * @@ -158,8 +231,8 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @atomicservice - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 + * @arkts 1.1 */ function off(type: 'locationChange', callback?: Callback): void; @@ -175,8 +248,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onLocationError(type: 'locationError', callback: Callback): void; + + /** + * Subscribe continuous location error changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationError' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the continuous location error. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationError')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + * @arkts 1.1 */ function on(type: 'locationError', callback: Callback): void; @@ -192,8 +282,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offLocationError(type: 'locationError', callback?: Callback): void; + + /** + * Unsubscribe continuous location error changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationError' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the continuous location error. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationError')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + * @arkts 1.1 */ function off(type: 'locationError', callback?: Callback): void; @@ -206,8 +313,22 @@ declare namespace geoLocationManager { * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationEnabledChange')} due to limited device capabilities. * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onLocationEnabledChange(type: 'locationEnabledChange', callback: Callback): void; + + /** + * Subscribe location switch changed. + * + * @param { 'locationEnabledChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the location switch status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationEnabledChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + * @arkts 1.1 */ function on(type: 'locationEnabledChange', callback: Callback): void; @@ -220,11 +341,43 @@ declare namespace geoLocationManager { * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationEnabledChange')} due to limited device capabilities. * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offLocationEnabledChange(type: 'locationEnabledChange', callback?: Callback): void; + + /** + * Unsubscribe location switch changed. + * + * @param { 'locationEnabledChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location switch status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationEnabledChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + * @arkts 1.1 */ function off(type: 'locationEnabledChange', callback?: Callback): void; + /** + * Subscribe to cache GNSS locations update messages. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'cachedGnssLocationsChange' } type - Indicates the location service event to be subscribed to. + * @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters. + * @param { Callback> } callback - Indicates the callback for reporting the cached GNSS locations. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('cachedGnssLocationsChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 20 + * @arkts 1.2 + */ + function onCachedGnssLocationsChange(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback>): void; + /** * Subscribe to cache GNSS locations update messages. * @@ -254,11 +407,28 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Gnss - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 + * @arkts 1.1 */ function on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback>): void; + /** + * Unsubscribe to cache GNSS locations update messages. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'cachedGnssLocationsChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback> } [callback] - Indicates the callback for reporting the cached gnss locations. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('cachedGnssLocationsChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 20 + * @arkts 1.2 + */ + function offCachedGnssLocationsChange(type: 'cachedGnssLocationsChange', callback?: Callback>): void; + /** * Unsubscribe to cache GNSS locations update messages. * @@ -286,8 +456,8 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Gnss - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 + * @arkts 1.1 */ function off(type: 'cachedGnssLocationsChange', callback?: Callback>): void; @@ -303,8 +473,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Gnss - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onSatelliteStatusChange(type: 'satelliteStatusChange', callback: Callback): void; + + /** + * Subscribe satellite status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'satelliteStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the satellite status. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('satelliteStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + * @arkts 1.1 */ function on(type: 'satelliteStatusChange', callback: Callback): void; @@ -320,8 +507,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Gnss - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offSatelliteStatusChange(type: 'satelliteStatusChange', callback?: Callback): void; + + /** + * Unsubscribe satellite status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'satelliteStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the satellite status. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('satelliteStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + * @arkts 1.1 */ function off(type: 'satelliteStatusChange', callback?: Callback): void; @@ -337,8 +541,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Gnss - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onNmeaMessage(type: 'nmeaMessage', callback: Callback): void; + + /** + * Subscribe nmea message changed. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'nmeaMessage' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the nmea message. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('nmeaMessage')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + * @arkts 1.1 */ function on(type: 'nmeaMessage', callback: Callback): void; @@ -354,11 +575,47 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Gnss - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offNmeaMessage(type: 'nmeaMessage', callback?: Callback): void; + + /** + * Unsubscribe nmea message changed. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'nmeaMessage' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the nmea message. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('nmeaMessage')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + * @arkts 1.1 */ function off(type: 'nmeaMessage', callback?: Callback): void; + /** + * Add a geofence and subscribe geofence status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'gnssFenceStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { GeofenceRequest } request - Indicates the Geofence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('gnssFenceStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 20 + * @arkts 1.2 + */ + function onGnssFenceStatusChange(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + /** * Add a geofence and subscribe geofence status changed. * @@ -374,6 +631,7 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301600 - Failed to operate the geofence. * @syscap SystemCapability.Location.Location.Geofence * @since 9 + * @arkts 1.1 */ function on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; @@ -388,12 +646,47 @@ declare namespace geoLocationManager { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('gnssFenceStatusChange')} due to limited device capabilities. * @throws { BusinessError } 3301000 - The location service is unavailable. - * @throws { BusinessError } 3301100 - The location switch is off. - * @throws { BusinessError } 3301600 - Failed to operate the geofence. - * @syscap SystemCapability.Location.Location.Geofence - * @since 9 + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 20 + * @arkts 1.2 + */ + function offGnssFenceStatusChange(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + + /** + * Remove a geofence and unsubscribe geofence status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'gnssFenceStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { GeofenceRequest } request - Indicates the Geofence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('gnssFenceStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + * @arkts 1.1 + */ + function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + + /** + * Registering the callback function for listening to country code changes. + * + * @param { 'countryCodeChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting country code changes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('countryCodeChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 20 + * @arkts 1.2 */ - function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + function onCountryCodeChange(type: 'countryCodeChange', callback: Callback): void; /** * Registering the callback function for listening to country code changes. @@ -405,8 +698,8 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301500 - Failed to query the area information. * @syscap SystemCapability.Location.Location.Core - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ function on(type: 'countryCodeChange', callback: Callback): void; @@ -420,8 +713,23 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301500 - Failed to query the area information. * @syscap SystemCapability.Location.Location.Core - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offCountryCodeChange(type: 'countryCodeChange', callback?: Callback): void; + + /** + * Unregistering the callback function for listening to country code changes. + * + * @param { 'countryCodeChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting country code changes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('countryCodeChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + * @arkts 1.1 */ function off(type: 'countryCodeChange', callback?: Callback): void; @@ -440,8 +748,28 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301800 - Failed to start WiFi or Bluetooth scanning. * @syscap SystemCapability.Location.Location.Core * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onLocatingRequiredDataChange(type: 'locatingRequiredDataChange', config: LocatingRequiredDataConfig, callback: Callback>): void; + + /** + * Subscribe to changes in WiFi/BT scanning information, + * and use the WiFi/BT scanning information for localization. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locatingRequiredDataChange' } type - Indicates the location service event to be subscribed to. + * @param { LocatingRequiredDataConfig } config - Indicates the locating required data configuration parameters. + * @param { Callback> } [callback] - Indicates the callback for reporting WiFi/BT scan info. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locatingRequiredDataChange')} due to limited device capabilities. + * @throws { BusinessError } 3301800 - Failed to start WiFi or Bluetooth scanning. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 10 + * @arkts 1.1 */ function on(type: 'locatingRequiredDataChange', config: LocatingRequiredDataConfig, callback: Callback>): void; @@ -457,8 +785,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locatingRequiredDataChange')} due to limited device capabilities. * @syscap SystemCapability.Location.Location.Core * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offLocatingRequiredDataChange(type: 'locatingRequiredDataChange', callback?: Callback>): void; + + /** + * Stop WiFi/BT scanning and unsubscribe from WiFi/BT scanning information changes. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locatingRequiredDataChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback> } [callback] - Indicates the callback for reporting WiFi/BT scan info. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locatingRequiredDataChange')} due to limited device capabilities. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 10 + * @arkts 1.1 */ function off(type: 'locatingRequiredDataChange', callback?: Callback>): void; @@ -473,8 +818,24 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onLocationIconStatusChange(type: 'locationIconStatusChange', callback: Callback): void; + + /** + * Subscribe location icon status changed. + * + * @param { 'locationIconStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the location icon status. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationIconStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 12 + * @arkts 1.1 */ function on(type: 'locationIconStatusChange', callback: Callback): void; @@ -489,8 +850,24 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offLocationIconStatusChange(type: 'locationIconStatusChange', callback?: Callback): void; + + /** + * Unsubscribe location icon status changed. + * + * @param { 'locationIconStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location icon status. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationIconStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 12 + * @arkts 1.1 */ function off(type: 'locationIconStatusChange', callback?: Callback): void; @@ -506,8 +883,25 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301100 - The location switch is off. * @syscap SystemCapability.Location.Location.Core - * @since arkts {'1.1':'16','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function onBluetoothScanResultChange(type: 'bluetoothScanResultChange', callback: Callback): void; + + /** + * Registers and listens to bluetooth scanning results for location services. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'bluetoothScanResultChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting Bluetooth scan info. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('bluetoothScanResultChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Core + * @since 16 + * @arkts 1.1 */ function on(type: 'bluetoothScanResultChange', callback: Callback): void; @@ -522,11 +916,74 @@ declare namespace geoLocationManager { * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('bluetoothScanResultChange')} due to limited device capabilities. * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core - * @since arkts {'1.1':'16','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function offBluetoothScanResultChange(type: 'bluetoothScanResultChange', callback?: Callback): void; + + /** + * Stop bluetooth scanning and unregister to listen to bluetooth scanning result changes. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'bluetoothScanResultChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting Bluetooth scan info. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('bluetoothScanResultChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 16 + * @arkts 1.1 */ function off(type: 'bluetoothScanResultChange', callback?: Callback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getCurrentLocation { GetCurrentLocationWithCallback, GetCurrentLocationReturnsPromise }; + + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest | SingleLocationRequest } [request] - Indicates the location request parameters. + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function GetCurrentLocationWithCallback(request?: CurrentLocationRequest | SingleLocationRequest, + callback: AsyncCallback): void; + + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest | SingleLocationRequest } [request] - Indicates the location request parameters. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function GetCurrentLocationReturnsPromise(request?: CurrentLocationRequest | SingleLocationRequest): + Promise; + + /** * Obtain current location. * @@ -572,8 +1029,7 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. * @syscap SystemCapability.Location.Location.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getCurrentLocation(request: CurrentLocationRequest | SingleLocationRequest, callback: AsyncCallback): void; @@ -605,8 +1061,7 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. * @syscap SystemCapability.Location.Location.Core * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getCurrentLocation(callback: AsyncCallback): void; @@ -727,6 +1182,45 @@ declare namespace geoLocationManager { */ function isLocationEnabledByUserId(userId: number): boolean; + /** + * @since 20 + * @arkts 1.2 + */ + overload enableLocation { enableLocationWithCallback, enableLocationReturnsPromise }; + + /** + * Enable location switch. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS and ohos.permission.CONTROL_LOCATION_SWITCH + * @param { AsyncCallback } callback - Indicates the callback for reporting the error message. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.enableLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function enableLocationWithCallback(callback: AsyncCallback): void; + + /** + * Enable location switch. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS and ohos.permission.CONTROL_LOCATION_SWITCH + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.enableLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function enableLocationReturnsPromise(): Promise; + /** * Enable location switch. * @@ -753,8 +1247,7 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @systemapi - * @since arkts {'1.1':'20','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 */ function enableLocation(callback: AsyncCallback): void; @@ -782,8 +1275,7 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @syscap SystemCapability.Location.Location.Core * @systemapi - * @since arkts {'1.1':'20','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 */ function enableLocation(): Promise; @@ -861,6 +1353,12 @@ declare namespace geoLocationManager { */ function setLocationSwitchIgnored(isIgnored: boolean): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getAddressesFromLocation { getAddressesFromLocationWithCallback, getAddressesFromLocationReturnsPromise }; + /** * Obtain address info from location. * @@ -871,8 +1369,37 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301300 - Reverse geocoding query failed. * @syscap SystemCapability.Location.Location.Geocoder - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getAddressesFromLocationWithCallback(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; + + /** + * Obtain address info from location. + * + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301300 - Reverse geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 20 + * @arkts 1.2 + */ + function getAddressesFromLocationReturnsPromise(request: ReverseGeoCodeRequest): Promise>; + + /** + * Obtain address info from location. + * + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the address info. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301300 - Reverse geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 */ function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; @@ -886,8 +1413,7 @@ declare namespace geoLocationManager { * @throws { BusinessError } 3301000 - The location service is unavailable. * @throws { BusinessError } 3301300 - Reverse geocoding query failed. * @syscap SystemCapability.Location.Location.Geocoder - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; -- Gitee