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 Impact**
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| namespace | declare namespace geolocation| Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **namespace geoLocationManager**.| 
23e41f4b71Sopenharmony_ci|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
24e41f4b71Sopenharmony_ci|geolocation| method | function off(type: 'locationChange', callback?: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
25e41f4b71Sopenharmony_ci|geolocation| method | function on(type: 'locationServiceState', callback: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
26e41f4b71Sopenharmony_ci|geolocation| method | function off(type: 'locationServiceState', callback?: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
27e41f4b71Sopenharmony_ci|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
28e41f4b71Sopenharmony_ci|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
29e41f4b71Sopenharmony_ci|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
30e41f4b71Sopenharmony_ci|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
31e41f4b71Sopenharmony_ci|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
32e41f4b71Sopenharmony_ci|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
33e41f4b71Sopenharmony_ci|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
34e41f4b71Sopenharmony_ci|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
35e41f4b71Sopenharmony_ci|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
36e41f4b71Sopenharmony_ci|geolocation| method | function getCurrentLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
37e41f4b71Sopenharmony_ci|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
38e41f4b71Sopenharmony_ci|geolocation| method | function getLastLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
39e41f4b71Sopenharmony_ci|geolocation| method | function getLastLocation(): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
40e41f4b71Sopenharmony_ci|geolocation| method | function isLocationEnabled(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
41e41f4b71Sopenharmony_ci|geolocation| method | function isLocationEnabled(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
42e41f4b71Sopenharmony_ci|geolocation| method | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted.| 
43e41f4b71Sopenharmony_ci|geolocation| method | function requestEnableLocation(): Promise<boolean>; | Deleted.| 
44e41f4b71Sopenharmony_ci|geolocation| method | function enableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
45e41f4b71Sopenharmony_ci|geolocation| method | function enableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
46e41f4b71Sopenharmony_ci|geolocation| method | function disableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
47e41f4b71Sopenharmony_ci|geolocation| method | function disableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
48e41f4b71Sopenharmony_ci|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
49e41f4b71Sopenharmony_ci|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
50e41f4b71Sopenharmony_ci|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
51e41f4b71Sopenharmony_ci|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
52e41f4b71Sopenharmony_ci|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
53e41f4b71Sopenharmony_ci|geolocation| method | function isGeoServiceAvailable(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
54e41f4b71Sopenharmony_ci|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
55e41f4b71Sopenharmony_ci|geolocation| method | function getCachedGnssLocationsSize(): Promise<number>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
56e41f4b71Sopenharmony_ci|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
57e41f4b71Sopenharmony_ci|geolocation| method | function flushCachedGnssLocations(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
58e41f4b71Sopenharmony_ci|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
59e41f4b71Sopenharmony_ci|geolocation| method | function sendCommand(command: LocationCommand): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.| 
60e41f4b71Sopenharmony_ci|geolocation| interface | SatelliteStatusInfo | Migrated to **@ohos.geoLocationManager.d.ts**.| 
61e41f4b71Sopenharmony_ci|geolocation| interface | CachedGnssLocationsRequest | Migrated to **@ohos.geoLocationManager.d.ts**.| 
62e41f4b71Sopenharmony_ci|geolocation| interface | GeofenceRequest | Migrated to **@ohos.geoLocationManager.d.ts**.| 
63e41f4b71Sopenharmony_ci|geolocation| interface | Geofence | Migrated to **@ohos.geoLocationManager.d.ts**.| 
64e41f4b71Sopenharmony_ci|geolocation| interface | ReverseGeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.| 
65e41f4b71Sopenharmony_ci|geolocation| interface | GeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.| 
66e41f4b71Sopenharmony_ci|geolocation| interface | GeoAddress | Migrated to **@ohos.geoLocationManager.d.ts**.| 
67e41f4b71Sopenharmony_ci|geolocation| interface | LocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.| 
68e41f4b71Sopenharmony_ci|geolocation| interface | CurrentLocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.| 
69e41f4b71Sopenharmony_ci|geolocation| interface | Location | Migrated to **@ohos.geoLocationManager.d.ts**.| 
70e41f4b71Sopenharmony_ci|geolocation| enum | LocationRequestPriority | Migrated to **@ohos.geoLocationManager.d.ts**.| 
71e41f4b71Sopenharmony_ci|geolocation| enum | LocationRequestScenario | Migrated to **@ohos.geoLocationManager.d.ts**.| 
72e41f4b71Sopenharmony_ci|geolocation| enum | GeoLocationErrorCode | Deprecated.| 
73e41f4b71Sopenharmony_ci|geolocation| enum | LocationPrivacyType | Migrated to **@ohos.geoLocationManager.d.ts**.| 
74e41f4b71Sopenharmony_ci|geolocation| enum | LocationCommand | Migrated to **@ohos.geoLocationManager.d.ts**.| 
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci**(Optional) Adaptation Guide**
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ciThe following sample code shows how to call **enableLocation** in the new version:
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci  ```ts
82e41f4b71Sopenharmony_ci  import geoLocationManager from '@ohos.geoLocationManager';
83e41f4b71Sopenharmony_ci  try {
84e41f4b71Sopenharmony_ci      geoLocationManager.enableLocation((err, data) => {
85e41f4b71Sopenharmony_ci          if (err) {
86e41f4b71Sopenharmony_ci              console.log('enableLocation: err=' + JSON.stringify(err));
87e41f4b71Sopenharmony_ci          }
88e41f4b71Sopenharmony_ci      });
89e41f4b71Sopenharmony_ci  } catch (err) {
90e41f4b71Sopenharmony_ci      console.error("errCode:" + err.code + ",errMessage:" + err.message);
91e41f4b71Sopenharmony_ci  }
92e41f4b71Sopenharmony_ci  ```
93