## cl.usb_manager.1 Error Information Return Method Change of APIs
The USB manager API uses service logic return values to indicate the error information, which does not comply with the API error code specifications of OpenHarmony. Beginning from API version 9, error information is returned by throwing exceptions.
**Change Impact**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Changed the USB module name from **@ohos.usb.d.ts** to **@ohos.usbV9.d.ts**, and added error code processing for all APIs in the module.
**Adaptation Guide**
Take the **getDevices** API as an example. The sample code is as follows:
```ts
importusbV9from'@ohos.usbV9'
try{
usbV9.getDevices();// If an improper parameter is passed to this API, an exception will be thrown.
## cl.location.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.geoLocationManager.d.ts
APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. However, APIs in API version 9 and system APIs all need to support throwing error codes. To support this function, all system APIs and APIs in API version 9 in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use system APIs and APIs in API version 9 of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
System APIs and APIs in API version 9 are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
Other APIs are not affected.
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| namespace | declare namespacegeolocation| Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface ReverseGeocodingMockInfo | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface LocationMockConfig | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface CountryCode | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | enum | export enum CountryCodeType | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoAddress | field | isFromMock?: Boolean; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.Location | field | isFromMock?: Boolean; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoLocationErrorCode | field | NOT_SUPPORTED = 100 | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoLocationErrorCode | field | QUERY_COUNTRY_CODE_ERROR | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'countryCodeChange', callback: Callback<CountryCode>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCountryCode(callback: AsyncCallback<CountryCode>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCountryCode(): Promise<CountryCode>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | Deleted this API in API version 9.|
|geolocation| method | function enableLocationMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario): Promise<void>; | Deleted this API in API version 9.|
|geolocation| method | function enableLocationMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | Deleted this API in API version 9.|
|geolocation| method | function disableLocationMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario): Promise<void>; | Deleted this API in API version 9.|
|geolocation| method | function disableLocationMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function enableReverseGeocodingMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableReverseGeocodingMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType): Promise<boolean>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<boolean>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the return value in the callback to **void**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise<boolean>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the return value in the promise to **void**. |
**(Optional) Adaptation Guide**
The following sample code shows how to call **enableLocation** in the new version:
## cl.location.2 Location Service Permission Change
From API version 9, the **ohos.permission.APPROXIMATELY_LOCATION** permission is added for obtaining the approximate location.
If you use API version 9 or later, you need to apply for both the **ohos.permission.LOCATION** and **ohos.permission.APPROXIMATELY_LOCATION** permissions. Applying for only the **ohos.permission.LOCATION** permission will fail.
**Change Impact**
Applications using API versions earlier than 9 are not affected. For an application using API version 9 or later, the method for applying for the location permission is changed. The details are as follows:
Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user as described below.
The system provides the following location permissions:
- ohos.permission.LOCATION
- ohos.permission.APPROXIMATELY_LOCATION
- ohos.permission.LOCATION_IN_BACKGROUND
If your application needs to access the device location information, it must first apply for required permissions. Specifically speaking:
API versions earlier than 9: Apply for **ohos.permission.LOCATION**.
API version 9 and later: Apply for **ohos.permission.APPROXIMATELY_LOCATION**, or apply for **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately.
| API Version| Location Permission| Permission Application Result| Location Accuracy|
| -------- | -------- | -------- | -------- |
| Earlier than 9| ohos.permission.LOCATION | Success| Location accurate to meters|
| 9 and later| ohos.permission.LOCATION | Failed| No location obtained.|
| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Success| Location accurate to 5 kilometers.|
| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Success| Location accurate to meters|
If your application needs to access the device location information when running in the background, it must be configured to be able to run in the background and be granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information after your application moves to the background.
You can declare the required permissions in your application's configuration file. For details, see the [permission application guide](../../../application-dev/security/accesstoken-guidelines.md).
**Key API/Component Changes**
Applications using API versions earlier than 9 are not affected.
If your application uses API version 9 or later and needs to call APIs requiring the **ohos.permission.LOCATION** permission in **@ohos.geolocation** and **@ohos.geoLocationManager**, you need to apply for the corresponding permission as described previously.
## cl.global.1 Support of Error Codes for the Internalization Module
APIs provided by the internationalization component of the globalization subsystem are changed to support error codes in the following scenarios. The following changes are made in API version 9:
- Obtaining the local expression of a country or language
- Obtaining the list of languages supported by the system and the list of areas supported by a language
- Checking whether a language matches an area
- Obtaining and setting the system language, country or region, and area
- Obtaining and setting the 24-hour format of the system
- Obtaining, adding, and removing the preferred language
- Obtaining and setting localized numbers
You need to adapt your application based on the following information.
**Change Impact**
The preceding APIs are changed to the static methods of the **System** class. When such an API is called, add the class name to the end of the module name.
For setter APIs, the type of the return value is changed from boolean to void, for example, setSystemLanguage.
When a call to an API fails, an error code is returned according to the failure cause. For example, when permissions are not correctly configured for an application, **201** is returned.
## cl.multimodalinput.1 Error Information Return Method Change of APIs
The internal APIs of the following modules used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later.
- Input consumer module (**@ohos.multimodalInput.inputConsumer.d.ts**): system APIs
- Screen hopping module (**@ohos.multimodalInput.inputDeviceCooperate.d.ts**): system APIs
- Key injection module (**@ohos.multimodalInput.inputEventClient.d.ts**): system APIs
- Input listening module (**@ohos.multimodalInput.inputMonitor.d.ts**): system APIs
- Mouse pointer module (**@ohos.multimodalInput.pointer.d.ts**): system APIs and third-party APIs
Asynchronous APIs in the preceding modules have the following changes: A parameter check error is returned synchronously; a service logic error is returned via **AsyncCallback** or the **error** object of **Promise**. No change is made to synchronous APIs.
**Change Impact**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
## cl.powermgr.1 Error Information Return Method Change of APIs
The **power** module uses service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. Therefore, modification is made in API version 9 and later.
- Power consumption statistics: [@ohos.batteryStatistics](../../../application-dev/reference/apis/js-apis-batteryStatistics.md)
Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**.
Synchronous API: An error message is returned via an exception.
#### Change Impact
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
#### Key API/Component Changes
Error code processing is added for the following APIs:
For details, see the API reference document of each API.
## cl.powermgr.2 System API Change
#### Change Impact
The application developed based on earlier versions needs to adapt to new API names and the new method for returning API error information. Otherwise, the original service logic will be affected.
## cl.request.1 Changes of Error Code Definitions and Some API Names
- The processing of the [upload and download error codes](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/errorcodes/errorcode-request.md) is added to the upload and download APIs.
- An error message is returned via **AsyncCallback** or the **error** object of **Promise**. An error message related to the parameter type or quantity is returned via an exception.
- Some APIs need to be replaced with new APIs, and the parameters remain unchanged.
**Change Impact**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type |
## cl.resourceManager.1 Name Change of Some Multi-Project APIs in API Version 9 of Resource Manager
The resource manager can return error codes and error information for APIs in API version 9 and later. Some multi-project APIs in API version 9 need to be adapted. The following changes are made in API version 9:
Some multi-project APIs of the resource manager need to be replaced with new APIs, and the parameters remain unchanged.
**Change Impact**
For applications developed based on earlier versions, relevant JavaScript multi-project APIs need to be replaced with new APIs.
The following describes how to change **getMedia** to **getMediaContent** in callback mode. The promise mode is similar. You only need to change the function name, add the error code and error information, and keep other information unchanged. The code snippet is as follows:
- Before the change: **getMedia(resource: Resource, callback: AsyncCallback<Uint8Array>): void;**
## cl.telephony.1 Input Parameter Change of System APIs of the SMS Module
Input parameters are changed for some released system APIs of the SMS module of the telephony subsystem, leading to noncompliance with the API specifications of OpenHarmony. The following changes are made in API version 9 and later:
The **slotId** parameter is added to the **isImsSmsSupported** API, indicating the slot ID.
**Change Impact**
Input parameters of JS APIs need to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
## cl.location.1 API Migration from @ohos.geolocation.d.ts to @ohos.geoLocationManager.d.ts
APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. To support this function, all APIs in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
All APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'locationChange', callback?: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'locationServiceState', callback: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'locationServiceState'** to **type: 'locationEnabledChange'**.|
|geolocation| method | function off(type: 'locationServiceState', callback?: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'locationServiceState'** to **type: 'locationEnabledChange'**.|
|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'cachedGnssLocationsReporting'** to **type: 'cachedGnssLocationsChange'**.|
|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'cachedGnssLocationsReporting'** to **type: 'cachedGnssLocationsChange'**.|
|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'gnssStatusChange'** to **type: 'satelliteStatusChange'**.|
|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'gnssStatusChange'** to **type: 'satelliteStatusChange'**.|
|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'nmeaMessageChange'** to **type: 'nmeaMessage'**.|
|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'nmeaMessageChange'** to **type: 'nmeaMessage'**.|
|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'fenceStatusChange'** to **type: 'gnssFenceStatusChange'**.|
|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'fenceStatusChange'** to **type: 'gnssFenceStatusChange'**.|
|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getLastLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function getLastLocation(): Location**.|
|geolocation| method | function getLastLocation(): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function getLastLocation(): Location**.|
|geolocation| method | function isLocationEnabled(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationEnabled(): boolean**.|
|geolocation| method | function isLocationEnabled(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationEnabled(): boolean**.|
|geolocation| method | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted.|
|geolocation| method | function requestEnableLocation(): Promise<boolean>; | Deleted.|
|geolocation| method | function enableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocation(): void**.|
|geolocation| method | function disableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocation(): void**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isGeocoderAvailable(): boolean**.|
|geolocation| method | function isGeoServiceAvailable(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isGeocoderAvailable(): boolean**.|
|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCachedGnssLocationsSize(): Promise<number>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableLocationMock(): void**.|
|geolocation| method | function enableLocationMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableLocationMock(): void**.|
|geolocation| method | function disableLocationMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocationMock(): void**.|
|geolocation| method | function disableLocationMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocationMock(): void**.|
|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setMockedLocations(config: LocationMockConfig): void**.|
|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setMockedLocations(config: LocationMockConfig): void**.|
|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableReverseGeocodingMock(): void**.|
|geolocation| method | function enableReverseGeocodingMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableReverseGeocodingMock(): void**.|
|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableReverseGeocodingMock(): void**.|
|geolocation| method | function disableReverseGeocodingMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableReverseGeocodingMock(): void**.|
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void**.|
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void**.|
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean**.|
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean**.|
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void**.|
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void**.|
|geolocation| interface | SatelliteStatusInfo | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CachedGnssLocationsRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeofenceRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Geofence | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | ReverseGeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoAddress | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | LocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CurrentLocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Location | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestPriority | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestScenario | Migrated to **@ohos.geoLocationManager.d.ts**.|
## cl.location.1 API Migration from @ohos.geolocation.d.ts to @ohos.geoLocationManager.d.ts
APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. To support this function, all APIs in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
All APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| namespace | declare namespace geolocation| Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **namespace geoLocationManager**.|
|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'locationChange', callback?: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'locationServiceState', callback: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'locationServiceState', callback?: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getLastLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getLastLocation(): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isLocationEnabled(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isLocationEnabled(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted.|
|geolocation| method | function requestEnableLocation(): Promise<boolean>; | Deleted.|
|geolocation| method | function enableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isGeoServiceAvailable(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCachedGnssLocationsSize(): Promise<number>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | SatelliteStatusInfo | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CachedGnssLocationsRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeofenceRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Geofence | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | ReverseGeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoAddress | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | LocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CurrentLocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Location | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestPriority | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestScenario | Migrated to **@ohos.geoLocationManager.d.ts**.|
## cl.location.1 API Migration from @system.geolocation.d.ts to @ohos.geoLocationManager.d.ts
APIs in **@system.geolocation.d.ts** do not support throwing error codes. To support this function, all APIs in **@system.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
All APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|Geolocation| class | Geolocation | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager**.|
|Geolocation| interface | static getLocation(options?: GetLocationOption): void; | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.getCurrentLocation**.|
|Geolocation| interface | static subscribe(options: SubscribeLocationOption): void; | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.on#event:locationChange**.|
|Geolocation| interface | static unsubscribe(): void; | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.off#event:locationChange**.|
|| interface | GeolocationResponse| Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.Location**.|
|| interface | GetLocationOption | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest**.|
|| interface | SubscribeLocationOption | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.LocationRequest**.|
**(Optional) Adaptation Guide**
The following sample code shows how to call **enableLocation** in the new version: