1e41f4b71Sopenharmony_ci# Location Subsystem ChangeLog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.location.1 API Migration from @ohos.geolocation.d.ts to @ohos.geoLocationManager.d.ts
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciAPIs 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.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciTo use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciimport geoLocationManager from '@ohos.geoLocationManager';
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**Change Impacts**
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciAll APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciimport geoLocationManager from '@ohos.geoLocationManager';
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci**Key API/Component Changes**
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci| Class       | API Type | Declaration                                                    | Change Type                                                    |
21e41f4b71Sopenharmony_ci| ----------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
22e41f4b71Sopenharmony_ci| geolocation | method    | function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
23e41f4b71Sopenharmony_ci| geolocation | method    | function off(type: 'locationChange', callback?: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
24e41f4b71Sopenharmony_ci| geolocation | method    | function on(type: 'locationServiceState', callback: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'locationServiceState'** to **type: 'locationEnabledChange'**.|
25e41f4b71Sopenharmony_ci| geolocation | method    | function off(type: 'locationServiceState', callback?: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'locationServiceState'** to **type: 'locationEnabledChange'**.|
26e41f4b71Sopenharmony_ci| 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'**.|
27e41f4b71Sopenharmony_ci| geolocation | method    | function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'cachedGnssLocationsReporting'** to **type: 'cachedGnssLocationsChange'**.|
28e41f4b71Sopenharmony_ci| geolocation | method    | function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'gnssStatusChange'** to **type: 'satelliteStatusChange'**.|
29e41f4b71Sopenharmony_ci| geolocation | method    | function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'gnssStatusChange'** to **type: 'satelliteStatusChange'**.|
30e41f4b71Sopenharmony_ci| geolocation | method    | function on(type: 'nmeaMessageChange', callback: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'nmeaMessageChange'** to **type: 'nmeaMessage'**.|
31e41f4b71Sopenharmony_ci| geolocation | method    | function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'nmeaMessageChange'** to **type: 'nmeaMessage'**.|
32e41f4b71Sopenharmony_ci| geolocation | method    | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'fenceStatusChange'** to **type: 'gnssFenceStatusChange'**.|
33e41f4b71Sopenharmony_ci| geolocation | method    | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'fenceStatusChange'** to **type: 'gnssFenceStatusChange'**.|
34e41f4b71Sopenharmony_ci| geolocation | method    | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
35e41f4b71Sopenharmony_ci| geolocation | method    | function getCurrentLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
36e41f4b71Sopenharmony_ci| geolocation | method    | function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
37e41f4b71Sopenharmony_ci| geolocation | method    | function getLastLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function getLastLocation(): Location**.|
38e41f4b71Sopenharmony_ci| geolocation | method    | function getLastLocation(): Promise<Location>;               | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function getLastLocation(): Location**.|
39e41f4b71Sopenharmony_ci| geolocation | method    | function isLocationEnabled(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationEnabled(): boolean**.|
40e41f4b71Sopenharmony_ci| geolocation | method    | function isLocationEnabled(): Promise<boolean>;              | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationEnabled(): boolean**.|
41e41f4b71Sopenharmony_ci| geolocation | method    | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted.                                                    |
42e41f4b71Sopenharmony_ci| geolocation | method    | function requestEnableLocation(): Promise<boolean>;          | Deleted.                                                    |
43e41f4b71Sopenharmony_ci| geolocation | method    | function enableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
44e41f4b71Sopenharmony_ci| geolocation | method    | function enableLocation(): Promise<boolean>;                 | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
45e41f4b71Sopenharmony_ci| geolocation | method    | function disableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocation(): void**.|
46e41f4b71Sopenharmony_ci| geolocation | method    | function disableLocation(): Promise<boolean>;                | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocation(): void**.|
47e41f4b71Sopenharmony_ci| geolocation | method    | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
48e41f4b71Sopenharmony_ci| geolocation | method    | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
49e41f4b71Sopenharmony_ci| geolocation | method    | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
50e41f4b71Sopenharmony_ci| geolocation | method    | function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
51e41f4b71Sopenharmony_ci| geolocation | method    | function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isGeocoderAvailable(): boolean**.|
52e41f4b71Sopenharmony_ci| geolocation | method    | function isGeoServiceAvailable(): Promise<boolean>;          | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isGeocoderAvailable(): boolean**.|
53e41f4b71Sopenharmony_ci| geolocation | method    | function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
54e41f4b71Sopenharmony_ci| geolocation | method    | function getCachedGnssLocationsSize(): Promise<number>;      | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
55e41f4b71Sopenharmony_ci| geolocation | method    | function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
56e41f4b71Sopenharmony_ci| geolocation | method    | function flushCachedGnssLocations(): Promise<boolean>;       | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
57e41f4b71Sopenharmony_ci| geolocation | method    | function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
58e41f4b71Sopenharmony_ci| geolocation | method    | function sendCommand(command: LocationCommand): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
59e41f4b71Sopenharmony_ci| geolocation | method    | function enableLocationMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableLocationMock(): void**.|
60e41f4b71Sopenharmony_ci| geolocation | method    | function enableLocationMock(): Promise<void>;                | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableLocationMock(): void**.|
61e41f4b71Sopenharmony_ci| geolocation | method    | function disableLocationMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocationMock(): void**.|
62e41f4b71Sopenharmony_ci| geolocation | method    | function disableLocationMock(): Promise<void>;               | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocationMock(): void**.|
63e41f4b71Sopenharmony_ci| geolocation | method    | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setMockedLocations(config: LocationMockConfig): void**.|
64e41f4b71Sopenharmony_ci| geolocation | method    | function setMockedLocations(config: LocationMockConfig): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setMockedLocations(config: LocationMockConfig): void**.|
65e41f4b71Sopenharmony_ci| geolocation | method    | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableReverseGeocodingMock(): void**.|
66e41f4b71Sopenharmony_ci| geolocation | method    | function enableReverseGeocodingMock(): Promise<void>;        | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableReverseGeocodingMock(): void**.|
67e41f4b71Sopenharmony_ci| geolocation | method    | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableReverseGeocodingMock(): void**.|
68e41f4b71Sopenharmony_ci| geolocation | method    | function disableReverseGeocodingMock(): Promise<void>;       | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableReverseGeocodingMock(): void**.|
69e41f4b71Sopenharmony_ci| 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**.|
70e41f4b71Sopenharmony_ci| geolocation | method    | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void**.|
71e41f4b71Sopenharmony_ci| geolocation | method    | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean**.|
72e41f4b71Sopenharmony_ci| geolocation | method    | function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean**.|
73e41f4b71Sopenharmony_ci| 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**.|
74e41f4b71Sopenharmony_ci| 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**.|
75e41f4b71Sopenharmony_ci| geolocation | interface | SatelliteStatusInfo                                          | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
76e41f4b71Sopenharmony_ci| geolocation | interface | CachedGnssLocationsRequest                                   | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
77e41f4b71Sopenharmony_ci| geolocation | interface | GeofenceRequest                                              | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
78e41f4b71Sopenharmony_ci| geolocation | interface | Geofence                                                     | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
79e41f4b71Sopenharmony_ci| geolocation | interface | ReverseGeoCodeRequest                                        | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
80e41f4b71Sopenharmony_ci| geolocation | interface | GeoCodeRequest                                               | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
81e41f4b71Sopenharmony_ci| geolocation | interface | GeoAddress                                                   | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
82e41f4b71Sopenharmony_ci| geolocation | interface | LocationRequest                                              | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
83e41f4b71Sopenharmony_ci| geolocation | interface | CurrentLocationRequest                                       | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
84e41f4b71Sopenharmony_ci| geolocation | interface | Location                                                     | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
85e41f4b71Sopenharmony_ci| geolocation | enum      | LocationRequestPriority                                      | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
86e41f4b71Sopenharmony_ci| geolocation | enum      | LocationRequestScenario                                      | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
87e41f4b71Sopenharmony_ci| geolocation | enum      | GeoLocationErrorCode                                         | Deprecated.                                                    |
88e41f4b71Sopenharmony_ci| geolocation | enum      | LocationPrivacyType                                          | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
89e41f4b71Sopenharmony_ci| geolocation | enum      | LocationCommand                                              | Migrated to **@ohos.geoLocationManager.d.ts**.                     |
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci**(Optional) Adaptation Guide**
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ciThe following sample code shows how to call **enableLocation** in the new version:
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci  ```ts
97e41f4b71Sopenharmony_ci  import geoLocationManager from '@ohos.geoLocationManager';
98e41f4b71Sopenharmony_ci  try {
99e41f4b71Sopenharmony_ci      geoLocationManager.enableLocation((err, data) => {
100e41f4b71Sopenharmony_ci          if (err) {
101e41f4b71Sopenharmony_ci              console.log('enableLocation: err=' + JSON.stringify(err));
102e41f4b71Sopenharmony_ci          }
103e41f4b71Sopenharmony_ci      });
104e41f4b71Sopenharmony_ci  } catch (err) {
105e41f4b71Sopenharmony_ci      console.error("errCode:" + err.code + ",errMessage:" + err.message);
106e41f4b71Sopenharmony_ci  }
107e41f4b71Sopenharmony_ci  ```
108