1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit LocationKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22import { WantAgent } from './@ohos.wantAgent'; 23import { NotificationRequest } from './notification/notificationRequest'; 24 25/** 26 * Provides interfaces for acquiring location information, managing location switches, 27 * geocoding, reverse geocoding, country code, fencing and other functions. 28 * 29 * @namespace geoLocationManager 30 * @since 9 31 */ 32/** 33 * Provides interfaces for acquiring location information, managing location switches, 34 * geocoding, reverse geocoding, country code, fencing and other functions. 35 * 36 * @namespace geoLocationManager 37 * @syscap SystemCapability.Location.Location.Core 38 * @atomicservice 39 * @since 11 40 */ 41declare namespace geoLocationManager { 42 /** 43 * Subscribe location changed. 44 * 45 * @permission ohos.permission.APPROXIMATELY_LOCATION 46 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 47 * @param { LocationRequest } request - Indicates the location request parameters. 48 * @param { Callback<Location> } callback - Indicates the callback for reporting the location result. 49 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 50 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 51 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. 52 * @throws { BusinessError } 3301000 - The location service is unavailable. 53 * @throws { BusinessError } 3301100 - The location switch is off. 54 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 55 * @syscap SystemCapability.Location.Location.Core 56 * @since 9 57 */ 58 /** 59 * Subscribe location changed. 60 * 61 * @permission ohos.permission.APPROXIMATELY_LOCATION 62 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 63 * @param { LocationRequest } request - Indicates the location request parameters. 64 * @param { Callback<Location> } callback - Indicates the callback for reporting the location result. 65 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 66 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 67 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. 68 * @throws { BusinessError } 3301000 - The location service is unavailable. 69 * @throws { BusinessError } 3301100 - The location switch is off. 70 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 71 * @syscap SystemCapability.Location.Location.Core 72 * @atomicservice 73 * @since 11 74 */ 75 /** 76 * Subscribe location changed. 77 * 78 * @permission ohos.permission.APPROXIMATELY_LOCATION 79 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 80 * @param { LocationRequest | ContinuousLocationRequest } request - Indicates the location request parameters. 81 * @param { Callback<Location> } callback - Indicates the callback for reporting the location result. 82 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 83 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 84 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. 85 * @throws { BusinessError } 3301000 - The location service is unavailable. 86 * @throws { BusinessError } 3301100 - The location switch is off. 87 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 88 * @syscap SystemCapability.Location.Location.Core 89 * @atomicservice 90 * @since 12 91 */ 92 function on(type: 'locationChange', request: LocationRequest | ContinuousLocationRequest, 93 callback: Callback<Location>): void; 94 95 /** 96 * Unsubscribe location changed. 97 * 98 * @permission ohos.permission.APPROXIMATELY_LOCATION 99 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 100 * @param { Callback<Location> } [callback] - Indicates the callback for reporting the location result. 101 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 102 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 103 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationChange')} due to limited device capabilities. 104 * @throws { BusinessError } 3301000 - The location service is unavailable. 105 * @throws { BusinessError } 3301100 - The location switch is off. 106 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 107 * @syscap SystemCapability.Location.Location.Core 108 * @since 9 109 */ 110 /** 111 * Unsubscribe location changed. 112 * 113 * @permission ohos.permission.APPROXIMATELY_LOCATION 114 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 115 * @param { Callback<Location> } [callback] - Indicates the callback for reporting the location result. 116 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 117 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 118 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationChange')} due to limited device capabilities. 119 * @throws { BusinessError } 3301000 - The location service is unavailable. 120 * @throws { BusinessError } 3301100 - The location switch is off. 121 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 122 * @syscap SystemCapability.Location.Location.Core 123 * @atomicservice 124 * @since 11 125 */ 126 function off(type: 'locationChange', callback?: Callback<Location>): void; 127 128 /** 129 * Subscribe continuous location error changed. 130 * 131 * @permission ohos.permission.APPROXIMATELY_LOCATION 132 * @param { 'locationError' } type - Indicates the location service event to be subscribed to. 133 * @param { Callback<LocationError> } callback - Indicates the callback for reporting the continuous location error. 134 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 135 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 136 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationError')} due to limited device capabilities. 137 * @throws { BusinessError } 3301000 - The location service is unavailable. 138 * @syscap SystemCapability.Location.Location.Core 139 * @atomicservice 140 * @since 12 141 */ 142 function on(type: 'locationError', callback: Callback<LocationError>): void; 143 144 /** 145 * Unsubscribe continuous location error changed. 146 * 147 * @permission ohos.permission.APPROXIMATELY_LOCATION 148 * @param { 'locationError' } type - Indicates the location service event to be subscribed to. 149 * @param { Callback<LocationError> } [callback] - Indicates the callback for reporting the continuous location error. 150 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 151 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 152 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationError')} due to limited device capabilities. 153 * @throws { BusinessError } 3301000 - The location service is unavailable. 154 * @syscap SystemCapability.Location.Location.Core 155 * @atomicservice 156 * @since 12 157 */ 158 function off(type: 'locationError', callback?: Callback<LocationError>): void; 159 160 /** 161 * Subscribe location switch changed. 162 * 163 * @param { 'locationEnabledChange' } type - Indicates the location service event to be subscribed to. 164 * @param { Callback<boolean> } callback - Indicates the callback for reporting the location switch status. 165 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 166 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationEnabledChange')} due to limited device capabilities. 167 * @throws { BusinessError } 3301000 - The location service is unavailable. 168 * @syscap SystemCapability.Location.Location.Core 169 * @since 9 170 */ 171 function on(type: 'locationEnabledChange', callback: Callback<boolean>): void; 172 173 /** 174 * Unsubscribe location switch changed. 175 * 176 * @param { 'locationEnabledChange' } type - Indicates the location service event to be subscribed to. 177 * @param { Callback<boolean> } [callback] - Indicates the callback for reporting the location switch status. 178 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 179 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationEnabledChange')} due to limited device capabilities. 180 * @throws { BusinessError } 3301000 - The location service is unavailable. 181 * @syscap SystemCapability.Location.Location.Core 182 * @since 9 183 */ 184 function off(type: 'locationEnabledChange', callback?: Callback<boolean>): void; 185 186 /** 187 * Subscribe to cache GNSS locations update messages. 188 * 189 * @permission ohos.permission.APPROXIMATELY_LOCATION 190 * @param { 'cachedGnssLocationsChange' } type - Indicates the location service event to be subscribed to. 191 * @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters. 192 * @param { Callback<Array<Location>> } callback - Indicates the callback for reporting the cached GNSS locations. 193 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 194 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 195 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('cachedGnssLocationsChange')} due to limited device capabilities. 196 * @throws { BusinessError } 3301000 - The location service is unavailable. 197 * @throws { BusinessError } 3301100 - The location switch is off. 198 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 199 * @syscap SystemCapability.Location.Location.Gnss 200 * @since 9 201 */ 202 function on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; 203 204 /** 205 * Unsubscribe to cache GNSS locations update messages. 206 * 207 * @permission ohos.permission.APPROXIMATELY_LOCATION 208 * @param { 'cachedGnssLocationsChange' } type - Indicates the location service event to be subscribed to. 209 * @param { Callback<Array<Location>> } [callback] - Indicates the callback for reporting the cached gnss locations. 210 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 211 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 212 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('cachedGnssLocationsChange')} due to limited device capabilities. 213 * @throws { BusinessError } 3301000 - The location service is unavailable. 214 * @throws { BusinessError } 3301100 - The location switch is off. 215 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 216 * @syscap SystemCapability.Location.Location.Gnss 217 * @since 9 218 */ 219 function off(type: 'cachedGnssLocationsChange', callback?: Callback<Array<Location>>): void; 220 221 /** 222 * Subscribe satellite status changed. 223 * 224 * @permission ohos.permission.APPROXIMATELY_LOCATION 225 * @param { 'satelliteStatusChange' } type - Indicates the location service event to be subscribed to. 226 * @param { Callback<SatelliteStatusInfo> } callback - Indicates the callback for reporting the satellite status. 227 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 228 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 229 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('satelliteStatusChange')} due to limited device capabilities. 230 * @throws { BusinessError } 3301000 - The location service is unavailable. 231 * @throws { BusinessError } 3301100 - The location switch is off. 232 * @syscap SystemCapability.Location.Location.Gnss 233 * @since 9 234 */ 235 function on(type: 'satelliteStatusChange', callback: Callback<SatelliteStatusInfo>): void; 236 237 /** 238 * Unsubscribe satellite status changed. 239 * 240 * @permission ohos.permission.APPROXIMATELY_LOCATION 241 * @param { 'satelliteStatusChange' } type - Indicates the location service event to be subscribed to. 242 * @param { Callback<SatelliteStatusInfo> } [callback] - Indicates the callback for reporting the satellite status. 243 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 244 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 245 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('satelliteStatusChange')} due to limited device capabilities. 246 * @throws { BusinessError } 3301000 - The location service is unavailable. 247 * @throws { BusinessError } 3301100 - The location switch is off. 248 * @syscap SystemCapability.Location.Location.Gnss 249 * @since 9 250 */ 251 function off(type: 'satelliteStatusChange', callback?: Callback<SatelliteStatusInfo>): void; 252 253 /** 254 * Subscribe nmea message changed. 255 * 256 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 257 * @param { 'nmeaMessage' } type - Indicates the location service event to be subscribed to. 258 * @param { Callback<string> } callback - Indicates the callback for reporting the nmea message. 259 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 260 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 261 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('nmeaMessage')} due to limited device capabilities. 262 * @throws { BusinessError } 3301000 - The location service is unavailable. 263 * @throws { BusinessError } 3301100 - The location switch is off. 264 * @syscap SystemCapability.Location.Location.Gnss 265 * @since 9 266 */ 267 function on(type: 'nmeaMessage', callback: Callback<string>): void; 268 269 /** 270 * Unsubscribe nmea message changed. 271 * 272 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 273 * @param { 'nmeaMessage' } type - Indicates the location service event to be subscribed to. 274 * @param { Callback<string> } [callback] - Indicates the callback for reporting the nmea message. 275 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 276 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 277 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('nmeaMessage')} due to limited device capabilities. 278 * @throws { BusinessError } 3301000 - The location service is unavailable. 279 * @throws { BusinessError } 3301100 - The location switch is off. 280 * @syscap SystemCapability.Location.Location.Gnss 281 * @since 9 282 */ 283 function off(type: 'nmeaMessage', callback?: Callback<string>): void; 284 285 /** 286 * Add a geofence and subscribe geofence status changed. 287 * 288 * @permission ohos.permission.APPROXIMATELY_LOCATION 289 * @param { 'gnssFenceStatusChange' } type - Indicates the location service event to be subscribed to. 290 * @param { GeofenceRequest } request - Indicates the Geofence configuration parameters. 291 * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. 292 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 293 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 294 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('gnssFenceStatusChange')} due to limited device capabilities. 295 * @throws { BusinessError } 3301000 - The location service is unavailable. 296 * @throws { BusinessError } 3301100 - The location switch is off. 297 * @throws { BusinessError } 3301600 - Failed to operate the geofence. 298 * @syscap SystemCapability.Location.Location.Geofence 299 * @since 9 300 */ 301 function on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; 302 303 /** 304 * Remove a geofence and unsubscribe geofence status changed. 305 * 306 * @permission ohos.permission.APPROXIMATELY_LOCATION 307 * @param { 'gnssFenceStatusChange' } type - Indicates the location service event to be subscribed to. 308 * @param { GeofenceRequest } request - Indicates the Geofence configuration parameters. 309 * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. 310 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 311 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 312 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('gnssFenceStatusChange')} due to limited device capabilities. 313 * @throws { BusinessError } 3301000 - The location service is unavailable. 314 * @throws { BusinessError } 3301100 - The location switch is off. 315 * @throws { BusinessError } 3301600 - Failed to operate the geofence. 316 * @syscap SystemCapability.Location.Location.Geofence 317 * @since 9 318 */ 319 function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; 320 321 /** 322 * Registering the callback function for listening to country code changes. 323 * 324 * @param { 'countryCodeChange' } type - Indicates the location service event to be subscribed to. 325 * @param { Callback<CountryCode> } callback - Indicates the callback for reporting country code changes. 326 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 327 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('countryCodeChange')} due to limited device capabilities. 328 * @throws { BusinessError } 3301000 - The location service is unavailable. 329 * @throws { BusinessError } 3301500 - Failed to query the area information. 330 * @syscap SystemCapability.Location.Location.Core 331 * @since 9 332 */ 333 function on(type: 'countryCodeChange', callback: Callback<CountryCode>): void; 334 335 /** 336 * Unregistering the callback function for listening to country code changes. 337 * 338 * @param { 'countryCodeChange' } type - Indicates the location service event to be subscribed to. 339 * @param { Callback<CountryCode> } [callback] - Indicates the callback for reporting country code changes. 340 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 341 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('countryCodeChange')} due to limited device capabilities. 342 * @throws { BusinessError } 3301000 - The location service is unavailable. 343 * @throws { BusinessError } 3301500 - Failed to query the area information. 344 * @syscap SystemCapability.Location.Location.Core 345 * @since 9 346 */ 347 function off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void; 348 349 /** 350 * Subscribe to changes in WiFi/BT scanning information, 351 * and use the WiFi/BT scanning information for localization. 352 * 353 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 354 * @param { 'locatingRequiredDataChange' } type - Indicates the location service event to be subscribed to. 355 * @param { LocatingRequiredDataConfig } config - Indicates the locating required data configuration parameters. 356 * @param { Callback<Array<LocatingRequiredData>> } [callback] - Indicates the callback for reporting WiFi/BT scan info. 357 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 358 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 359 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 360 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locatingRequiredDataChange')} due to limited device capabilities. 361 * @throws { BusinessError } 3301800 - Failed to start WiFi or Bluetooth scanning. 362 * @syscap SystemCapability.Location.Location.Core 363 * @systemapi 364 * @since 10 365 */ 366 function on(type: 'locatingRequiredDataChange', config: LocatingRequiredDataConfig, callback: Callback<Array<LocatingRequiredData>>): void; 367 368 /** 369 * Stop WiFi/BT scanning and unsubscribe from WiFi/BT scanning information changes. 370 * 371 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 372 * @param { 'locatingRequiredDataChange' } type - Indicates the location service event to be subscribed to. 373 * @param { Callback<Array<LocatingRequiredData>> } [callback] - Indicates the callback for reporting WiFi/BT scan info. 374 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 375 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 376 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 377 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locatingRequiredDataChange')} due to limited device capabilities. 378 * @syscap SystemCapability.Location.Location.Core 379 * @systemapi 380 * @since 10 381 */ 382 function off(type: 'locatingRequiredDataChange', callback?: Callback<Array<LocatingRequiredData>>): void; 383 384 /** 385 * Subscribe location icon status changed. 386 * 387 * @param { 'locationIconStatusChange' } type - Indicates the location service event to be subscribed to. 388 * @param { Callback<LocationIconStatus> } callback - Indicates the callback for reporting the location icon status. 389 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 390 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 391 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationIconStatusChange')} due to limited device capabilities. 392 * @throws { BusinessError } 3301000 - The location service is unavailable. 393 * @syscap SystemCapability.Location.Location.Core 394 * @systemapi 395 * @since 12 396 */ 397 function on(type: 'locationIconStatusChange', callback: Callback<LocationIconStatus>): void; 398 399 /** 400 * Unsubscribe location icon status changed. 401 * 402 * @param { 'locationIconStatusChange' } type - Indicates the location service event to be subscribed to. 403 * @param { Callback<LocationIconStatus> } [callback] - Indicates the callback for reporting the location icon status. 404 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 405 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 406 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationIconStatusChange')} due to limited device capabilities. 407 * @throws { BusinessError } 3301000 - The location service is unavailable. 408 * @syscap SystemCapability.Location.Location.Core 409 * @systemapi 410 * @since 12 411 */ 412 function off(type: 'locationIconStatusChange', callback?: Callback<LocationIconStatus>): void; 413 414 /** 415 * Obtain current location. 416 * 417 * @permission ohos.permission.APPROXIMATELY_LOCATION 418 * @param { CurrentLocationRequest } request - Indicates the location request parameters. 419 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 420 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 421 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 422 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 423 * @throws { BusinessError } 3301000 - The location service is unavailable. 424 * @throws { BusinessError } 3301100 - The location switch is off. 425 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 426 * @syscap SystemCapability.Location.Location.Core 427 * @since 9 428 */ 429 /** 430 * Obtain current location. 431 * 432 * @permission ohos.permission.APPROXIMATELY_LOCATION 433 * @param { CurrentLocationRequest } request - Indicates the location request parameters. 434 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 435 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 436 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 437 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 438 * @throws { BusinessError } 3301000 - The location service is unavailable. 439 * @throws { BusinessError } 3301100 - The location switch is off. 440 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 441 * @syscap SystemCapability.Location.Location.Core 442 * @atomicservice 443 * @since 11 444 */ 445 /** 446 * Obtain current location. 447 * 448 * @permission ohos.permission.APPROXIMATELY_LOCATION 449 * @param { CurrentLocationRequest | SingleLocationRequest } request - Indicates the location request parameters. 450 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 451 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 452 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 453 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 454 * @throws { BusinessError } 3301000 - The location service is unavailable. 455 * @throws { BusinessError } 3301100 - The location switch is off. 456 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 457 * @syscap SystemCapability.Location.Location.Core 458 * @atomicservice 459 * @since 12 460 */ 461 function getCurrentLocation(request: CurrentLocationRequest | SingleLocationRequest, 462 callback: AsyncCallback<Location>): void; 463 464 /** 465 * Obtain current location. 466 * 467 * @permission ohos.permission.APPROXIMATELY_LOCATION 468 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 469 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 470 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 471 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 472 * @throws { BusinessError } 3301000 - The location service is unavailable. 473 * @throws { BusinessError } 3301100 - The location switch is off. 474 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 475 * @syscap SystemCapability.Location.Location.Core 476 * @since 9 477 */ 478 /** 479 * Obtain current location. 480 * 481 * @permission ohos.permission.APPROXIMATELY_LOCATION 482 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 483 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 485 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 486 * @throws { BusinessError } 3301000 - The location service is unavailable. 487 * @throws { BusinessError } 3301100 - The location switch is off. 488 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 489 * @syscap SystemCapability.Location.Location.Core 490 * @atomicservice 491 * @since 11 492 */ 493 function getCurrentLocation(callback: AsyncCallback<Location>): void; 494 495 /** 496 * Obtain current location. 497 * 498 * @permission ohos.permission.APPROXIMATELY_LOCATION 499 * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. 500 * @returns { Promise<Location> } The promise returned by the function. 501 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 502 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 503 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 504 * @throws { BusinessError } 3301000 - The location service is unavailable. 505 * @throws { BusinessError } 3301100 - The location switch is off. 506 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 507 * @syscap SystemCapability.Location.Location.Core 508 * @since 9 509 */ 510 /** 511 * Obtain current location. 512 * 513 * @permission ohos.permission.APPROXIMATELY_LOCATION 514 * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. 515 * @returns { Promise<Location> } The promise returned by the function. 516 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 517 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 518 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 519 * @throws { BusinessError } 3301000 - The location service is unavailable. 520 * @throws { BusinessError } 3301100 - The location switch is off. 521 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 522 * @syscap SystemCapability.Location.Location.Core 523 * @atomicservice 524 * @since 11 525 */ 526 /** 527 * Obtain current location. 528 * 529 * @permission ohos.permission.APPROXIMATELY_LOCATION 530 * @param { CurrentLocationRequest | SingleLocationRequest } [request] - Indicates the location request parameters. 531 * @returns { Promise<Location> } The promise returned by the function. 532 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 533 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 534 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. 535 * @throws { BusinessError } 3301000 - The location service is unavailable. 536 * @throws { BusinessError } 3301100 - The location switch is off. 537 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 538 * @syscap SystemCapability.Location.Location.Core 539 * @atomicservice 540 * @since 12 541 */ 542 function getCurrentLocation(request?: CurrentLocationRequest | SingleLocationRequest): 543 Promise<Location>; 544 545 /** 546 * Obtain last known location. 547 * 548 * @permission ohos.permission.APPROXIMATELY_LOCATION 549 * @returns { Location } The last known location information. 550 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 551 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getLastLocation} due to limited device capabilities. 552 * @throws { BusinessError } 3301000 - The location service is unavailable. 553 * @throws { BusinessError } 3301100 - The location switch is off. 554 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 555 * @syscap SystemCapability.Location.Location.Core 556 * @since 9 557 */ 558 /** 559 * Obtain last known location. 560 * 561 * @permission ohos.permission.APPROXIMATELY_LOCATION 562 * @returns { Location } The last known location information. 563 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 564 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getLastLocation} due to limited device capabilities. 565 * @throws { BusinessError } 3301000 - The location service is unavailable. 566 * @throws { BusinessError } 3301100 - The location switch is off. 567 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 568 * @syscap SystemCapability.Location.Location.Core 569 * @atomicservice 570 * @since 11 571 */ 572 function getLastLocation(): Location; 573 574 /** 575 * Obtain current location switch status. 576 * 577 * @returns { boolean } Returns {@code true} if the location switch on, returns {@code false} otherwise. 578 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isLocationEnabled} due to limited device capabilities. 579 * @throws { BusinessError } 3301000 - The location service is unavailable. 580 * @syscap SystemCapability.Location.Location.Core 581 * @since 9 582 */ 583 /** 584 * Obtain current location switch status. 585 * 586 * @returns { boolean } Returns {@code true} if the location switch on, returns {@code false} otherwise. 587 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isLocationEnabled} due to limited device capabilities. 588 * @throws { BusinessError } 3301000 - The location service is unavailable. 589 * @syscap SystemCapability.Location.Location.Core 590 * @atomicservice 591 * @since 11 592 */ 593 function isLocationEnabled(): boolean; 594 595 /** 596 * Enable location switch. 597 * 598 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 599 * @param { AsyncCallback<void> } callback - Indicates the callback for reporting the error message. 600 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 601 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 603 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.enableLocation} due to limited device capabilities. 604 * @throws { BusinessError } 3301000 - The location service is unavailable. 605 * @syscap SystemCapability.Location.Location.Core 606 * @systemapi 607 * @since 9 608 */ 609 function enableLocation(callback: AsyncCallback<void>): void; 610 611 /** 612 * Enable location switch. 613 * 614 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 615 * @returns { Promise<void> } The promise returned by the function. 616 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 617 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 618 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.enableLocation} due to limited device capabilities. 619 * @throws { BusinessError } 3301000 - The location service is unavailable. 620 * @syscap SystemCapability.Location.Location.Core 621 * @systemapi 622 * @since 9 623 */ 624 function enableLocation(): Promise<void>; 625 626 /** 627 * Disable location switch. 628 * 629 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 630 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 631 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 632 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.disableLocation} due to limited device capabilities. 633 * @throws { BusinessError } 3301000 - The location service is unavailable. 634 * @syscap SystemCapability.Location.Location.Core 635 * @systemapi 636 * @since 9 637 */ 638 function disableLocation(): void; 639 640 /** 641 * Obtain address info from location. 642 * 643 * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. 644 * @param { AsyncCallback<Array<GeoAddress>> } callback - Indicates the callback for reporting the address info. 645 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 646 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities. 647 * @throws { BusinessError } 3301000 - The location service is unavailable. 648 * @throws { BusinessError } 3301300 - Reverse geocoding query failed. 649 * @syscap SystemCapability.Location.Location.Geocoder 650 * @since 9 651 */ 652 function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; 653 654 /** 655 * Obtain address info from location. 656 * 657 * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. 658 * @returns { Promise<Array<GeoAddress>> } The promise returned by the function. 659 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 660 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities. 661 * @throws { BusinessError } 3301000 - The location service is unavailable. 662 * @throws { BusinessError } 3301300 - Reverse geocoding query failed. 663 * @syscap SystemCapability.Location.Location.Geocoder 664 * @since 9 665 */ 666 function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; 667 668 /** 669 * Obtain latitude and longitude info from location address. 670 * 671 * @param { GeoCodeRequest } request - Indicates the geocode query parameters. 672 * @param { AsyncCallback<Array<GeoAddress>> } callback - Indicates the callback for reporting the latitude and longitude result. 673 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 674 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocationName} due to limited device capabilities. 675 * @throws { BusinessError } 3301000 - The location service is unavailable. 676 * @throws { BusinessError } 3301400 - Geocoding query failed. 677 * @syscap SystemCapability.Location.Location.Geocoder 678 * @since 9 679 */ 680 function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; 681 682 /** 683 * Obtain latitude and longitude info from location address. 684 * 685 * @param { GeoCodeRequest } request - Indicates the geocode query parameters. 686 * @returns { Promise<Array<GeoAddress>> } The promise returned by the function. 687 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 688 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocationName} due to limited device capabilities. 689 * @throws { BusinessError } 3301000 - The location service is unavailable. 690 * @throws { BusinessError } 3301400 - Geocoding query failed. 691 * @syscap SystemCapability.Location.Location.Geocoder 692 * @since 9 693 */ 694 function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; 695 696 /** 697 * Obtain geocoding service status. 698 * 699 * @returns { boolean } Returns {@code true} if geocoding service is available, returns {@code false} otherwise. 700 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isGeocoderAvailable} due to limited device capabilities. 701 * @throws { BusinessError } 3301000 - The location service is unavailable. 702 * @syscap SystemCapability.Location.Location.Geocoder 703 * @since 9 704 */ 705 function isGeocoderAvailable(): boolean; 706 707 /** 708 * Obtain the number of cached GNSS locations reported at a time. 709 * 710 * @permission ohos.permission.APPROXIMATELY_LOCATION 711 * @param { AsyncCallback<number> } callback - Indicates the callback for reporting the cached GNSS locations size. 712 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 713 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 714 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCachedGnssLocationsSize} due to limited device capabilities. 715 * @throws { BusinessError } 3301000 - The location service is unavailable. 716 * @throws { BusinessError } 3301100 - The location switch is off. 717 * @syscap SystemCapability.Location.Location.Gnss 718 * @since 9 719 */ 720 function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; 721 722 /** 723 * Obtain the number of cached GNSS locations. 724 * 725 * @permission ohos.permission.APPROXIMATELY_LOCATION 726 * @returns { Promise<number> } The promise returned by the function. 727 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 728 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCachedGnssLocationsSize} due to limited device capabilities. 729 * @throws { BusinessError } 3301000 - The location service is unavailable. 730 * @throws { BusinessError } 3301100 - The location switch is off. 731 * @syscap SystemCapability.Location.Location.Gnss 732 * @since 9 733 */ 734 function getCachedGnssLocationsSize(): Promise<number>; 735 736 /** 737 * All prepared GNSS locations are returned to the application through the callback function, 738 * and the bottom-layer buffer is cleared. 739 * 740 * @permission ohos.permission.APPROXIMATELY_LOCATION 741 * @param { AsyncCallback<void> } callback - Indicates the callback for reporting the error message. 742 * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, 743 * If the function executes successfully, execute the callback function only, no data will be returned. 744 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 745 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 746 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.flushCachedGnssLocations} due to limited device capabilities. 747 * @throws { BusinessError } 3301000 - The location service is unavailable. 748 * @throws { BusinessError } 3301100 - The location switch is off. 749 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 750 * @syscap SystemCapability.Location.Location.Gnss 751 * @since 9 752 */ 753 function flushCachedGnssLocations(callback: AsyncCallback<void>): void; 754 755 /** 756 * All prepared GNSS locations are returned to the application, 757 * and the bottom-layer buffer is cleared. 758 * 759 * @permission ohos.permission.APPROXIMATELY_LOCATION 760 * @returns { Promise<void> } The promise returned by the function. 761 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 762 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.flushCachedGnssLocations} due to limited device capabilities. 763 * @throws { BusinessError } 3301000 - The location service is unavailable. 764 * @throws { BusinessError } 3301100 - The location switch is off. 765 * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. 766 * @syscap SystemCapability.Location.Location.Gnss 767 * @since 9 768 */ 769 function flushCachedGnssLocations(): Promise<void>; 770 771 /** 772 * Send extended commands to location subsystem. 773 * 774 * @param { LocationCommand } command - Indicates the extended command message body. 775 * @param { AsyncCallback<void> } callback - Indicates the callback for reporting the error message. 776 * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, 777 * If the function executes successfully, execute the callback function only, no data will be returned. 778 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 779 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.sendCommand} due to limited device capabilities. 780 * @throws { BusinessError } 3301000 - The location service is unavailable. 781 * @syscap SystemCapability.Location.Location.Core 782 * @since 9 783 */ 784 function sendCommand(command: LocationCommand, callback: AsyncCallback<void>): void; 785 786 /** 787 * Send extended commands to location subsystem. 788 * 789 * @param { LocationCommand } command - Indicates the extended command message body. 790 * @returns { Promise<void> } The promise returned by the function. 791 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 792 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.sendCommand} due to limited device capabilities. 793 * @throws { BusinessError } 3301000 - The location service is unavailable. 794 * @syscap SystemCapability.Location.Location.Core 795 * @since 9 796 */ 797 function sendCommand(command: LocationCommand): Promise<void>; 798 799 /** 800 * Obtain the current country code. 801 * 802 * @param { AsyncCallback<CountryCode> } callback - Indicates the callback for reporting the country code. 803 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 804 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCountryCode} due to limited device capabilities. 805 * @throws { BusinessError } 3301000 - The location service is unavailable. 806 * @throws { BusinessError } 3301500 - Failed to query the area information. 807 * @syscap SystemCapability.Location.Location.Core 808 * @since 9 809 */ 810 function getCountryCode(callback: AsyncCallback<CountryCode>): void; 811 812 /** 813 * Obtain the current country code. 814 * 815 * @returns { Promise<CountryCode> } The promise returned by the function. 816 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCountryCode} due to limited device capabilities. 817 * @throws { BusinessError } 3301000 - The location service is unavailable. 818 * @throws { BusinessError } 3301500 - Failed to query the area information. 819 * @syscap SystemCapability.Location.Location.Core 820 * @since 9 821 */ 822 function getCountryCode(): Promise<CountryCode>; 823 824 /** 825 * Enable the geographical location simulation function. 826 * 827 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 828 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.enableLocationMock} due to limited device capabilities. 829 * @throws { BusinessError } 3301000 - The location service is unavailable. 830 * @throws { BusinessError } 3301100 - The location switch is off. 831 * @syscap SystemCapability.Location.Location.Core 832 * @systemapi 833 * @since 9 834 */ 835 function enableLocationMock(): void; 836 837 /** 838 * Disable the geographical location simulation function. 839 * 840 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 841 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.disableLocationMock} due to limited device capabilities. 842 * @throws { BusinessError } 3301000 - The location service is unavailable. 843 * @throws { BusinessError } 3301100 - The location switch is off. 844 * @syscap SystemCapability.Location.Location.Core 845 * @systemapi 846 * @since 9 847 */ 848 function disableLocationMock(): void; 849 850 /** 851 * Set the configuration parameters for location simulation. 852 * 853 * @param { LocationMockConfig } config - Indicates the configuration parameters for location simulation. 854 * Contains the array of locations and reporting intervals that need to be simulated. 855 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 856 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 857 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.setMockedLocations} due to limited device capabilities. 858 * @throws { BusinessError } 3301000 - The location service is unavailable. 859 * @throws { BusinessError } 3301100 - The location switch is off. 860 * @syscap SystemCapability.Location.Location.Core 861 * @systemapi 862 * @since 9 863 */ 864 function setMockedLocations(config: LocationMockConfig): void; 865 866 /** 867 * Enable the reverse geocoding simulation function. 868 * 869 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 870 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.enableReverseGeocodingMock} due to limited device capabilities. 871 * @throws { BusinessError } 3301000 - The location service is unavailable. 872 * @syscap SystemCapability.Location.Location.Core 873 * @systemapi 874 * @since 9 875 */ 876 function enableReverseGeocodingMock(): void; 877 878 /** 879 * Disable the reverse geocoding simulation function. 880 * 881 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 882 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.disableReverseGeocodingMock} due to limited device capabilities. 883 * @throws { BusinessError } 3301000 - The location service is unavailable. 884 * @syscap SystemCapability.Location.Location.Core 885 * @systemapi 886 * @since 9 887 */ 888 function disableReverseGeocodingMock(): void; 889 890 /** 891 * Set the configuration parameters for simulating reverse geocoding. 892 * 893 * @param { Array<ReverseGeocodingMockInfo> } mockInfos - Indicates the set of locations and place names to be simulated. 894 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 895 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 896 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.setReverseGeocodingMockInfo} due to limited device capabilities. 897 * @throws { BusinessError } 3301000 - The location service is unavailable. 898 * @syscap SystemCapability.Location.Location.Core 899 * @systemapi 900 * @since 9 901 */ 902 function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void; 903 904 /** 905 * Querying location privacy protocol confirmation status. 906 * 907 * @param { LocationPrivacyType } type - Indicates location privacy protocol type. 908 * @returns { boolean } Returns {@code true} if the location privacy protocol has been confirmed, returns {@code false} otherwise. 909 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 910 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 911 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isLocationPrivacyConfirmed} due to limited device capabilities. 912 * @throws { BusinessError } 3301000 - The location service is unavailable. 913 * @syscap SystemCapability.Location.Location.Core 914 * @systemapi 915 * @since 9 916 */ 917 function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean; 918 919 /** 920 * Set location privacy protocol confirmation status. 921 * 922 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 923 * @param { LocationPrivacyType } type - Indicates location privacy protocol type. 924 * @param { boolean } isConfirmed - Indicates whether the location privacy protocol has been confirmed. 925 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 926 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 927 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 928 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.setLocationPrivacyConfirmStatus} due to limited device capabilities. 929 * @throws { BusinessError } 3301000 - The location service is unavailable. 930 * @syscap SystemCapability.Location.Location.Core 931 * @systemapi 932 * @since 9 933 */ 934 function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void; 935 936 /** 937 * Get WiFi/BT scanning information, and use the WiFi/BT scanning information for localization. 938 * 939 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 940 * @param { LocatingRequiredDataConfig } config - Indicates the request parameters for obtaining the data required for locating. 941 * @returns { Promise<Array<LocatingRequiredData>> } The promise returned by the function, for reporting WiFi/BT scan info. 942 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 943 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 944 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 945 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getLocatingRequiredData} due to limited device capabilities. 946 * @throws { BusinessError } 3301800 - Failed to start WiFi or Bluetooth scanning. 947 * @syscap SystemCapability.Location.Location.Core 948 * @systemapi 949 * @since 10 950 */ 951 function getLocatingRequiredData(config: LocatingRequiredDataConfig): Promise<Array<LocatingRequiredData>>; 952 953 /** 954 * Add a geofence. 955 * 956 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 957 * @param { GnssGeofenceRequest } fenceRequest - Indicates the Geofence configuration parameters. 958 * @returns { Promise<number> } The promise returned by the function, for reporting the ID of geofence. 959 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 960 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 961 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.addGnssGeofence} due to limited device capabilities. 962 * @throws { BusinessError } 3301000 - The location service is unavailable. 963 * @throws { BusinessError } 3301100 - The location switch is off. 964 * @throws { BusinessError } 3301601 - The number of geofences exceeds the maximum. 965 * @syscap SystemCapability.Location.Location.Geofence 966 * @since 12 967 */ 968 function addGnssGeofence(fenceRequest: GnssGeofenceRequest): Promise<number>; 969 970 /** 971 * Remove a geofence. 972 * 973 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 974 * @param { number } geofenceId - Indicates the ID of geofence. 975 * @returns { Promise<void> } The promise returned by the function. 976 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 977 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 978 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.removeGnssGeofence} due to limited device capabilities. 979 * @throws { BusinessError } 3301000 - The location service is unavailable. 980 * @throws { BusinessError } 3301602 - Failed to delete a geofence due to an incorrect ID. 981 * @syscap SystemCapability.Location.Location.Geofence 982 * @since 12 983 */ 984 function removeGnssGeofence(geofenceId: number): Promise<void>; 985 986 /** 987 * Obtains the coordinate system types supported by geofence. 988 * 989 * @returns { Array<CoordinateSystemType> } Return the coordinate system types supported by geofence. 990 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getGeofenceSupportedCoordTypes} due to limited device capabilities. 991 * @throws { BusinessError } 3301000 - The location service is unavailable. 992 * @syscap SystemCapability.Location.Location.Geofence 993 * @since 12 994 */ 995 function getGeofenceSupportedCoordTypes(): Array<CoordinateSystemType>; 996 997 /** 998 * Get location icon status. 999 * 1000 * @returns { LocationIconStatus } The location icon status. 1001 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1002 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getLocationIconStatus} due to limited device capabilities. 1003 * @throws { BusinessError } 3301000 - The location service is unavailable. 1004 * @syscap SystemCapability.Location.Location.Core 1005 * @systemapi 1006 * @since 12 1007 */ 1008 function getLocationIconStatus(): LocationIconStatus; 1009 1010 /** 1011 * Obtains the BSSID of the connected Wi-Fi hotspot. 1012 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1013 * @returns {string} Returns the BSSID of the connected Wi-Fi hotspot. 1014 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1015 * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentWifiBssidForLocating()} due to limited device capabilities. 1016 * @throws { BusinessError } 3301000 - The location service is unavailable. 1017 * @throws { BusinessError } 3301100 - The location switch is off. 1018 * @throws { BusinessError } 3301900 - Failed to obtain the BSSID of the Wi-Fi hotspot. The Wi-Fi network is not connected. 1019 * @syscap SystemCapability.Location.Location.Core 1020 * @crossplatform 1021 * @since 14 1022 */ 1023 function getCurrentWifiBssidForLocating(): string; 1024 1025 /** 1026 * Configuration parameters for simulating reverse geocoding. 1027 * 1028 * @typedef ReverseGeocodingMockInfo 1029 * @syscap SystemCapability.Location.Location.Core 1030 * @systemapi 1031 * @since 9 1032 */ 1033 export interface ReverseGeocodingMockInfo { 1034 /** 1035 * Location for which reverse geocoding query is required. 1036 * 1037 * @type { ReverseGeoCodeRequest } 1038 * @syscap SystemCapability.Location.Location.Core 1039 * @systemapi 1040 * @since 9 1041 */ 1042 location: ReverseGeoCodeRequest; 1043 1044 /** 1045 * Actual address information corresponding to the location. 1046 * 1047 * @type { GeoAddress } 1048 * @syscap SystemCapability.Location.Location.Core 1049 * @systemapi 1050 * @since 9 1051 */ 1052 geoAddress: GeoAddress; 1053 } 1054 1055 /** 1056 * Parameters for configuring the location simulation function. 1057 * 1058 * @typedef LocationMockConfig 1059 * @syscap SystemCapability.Location.Location.Core 1060 * @systemapi 1061 * @since 9 1062 */ 1063 export interface LocationMockConfig { 1064 /** 1065 * Interval for reporting simulated locations. 1066 * 1067 * @type { number } 1068 * @syscap SystemCapability.Location.Location.Core 1069 * @systemapi 1070 * @since 9 1071 */ 1072 timeInterval: number; 1073 1074 /** 1075 * Mock location array. 1076 * 1077 * @type { Array<Location> } 1078 * @syscap SystemCapability.Location.Location.Core 1079 * @systemapi 1080 * @since 9 1081 */ 1082 locations: Array<Location>; 1083 } 1084 1085 /** 1086 * Satellite status information. 1087 * 1088 * @typedef SatelliteStatusInfo 1089 * @syscap SystemCapability.Location.Location.Gnss 1090 * @since 9 1091 */ 1092 export interface SatelliteStatusInfo { 1093 /** 1094 * Number of satellites. 1095 * 1096 * @type { number } 1097 * @syscap SystemCapability.Location.Location.Gnss 1098 * @since 9 1099 */ 1100 satellitesNumber: number; 1101 1102 /** 1103 * Satellite ID array. 1104 * 1105 * @type { Array<number> } 1106 * @syscap SystemCapability.Location.Location.Gnss 1107 * @since 9 1108 */ 1109 satelliteIds: Array<number>; 1110 1111 /** 1112 * Carrier to noise density array. 1113 * 1114 * @type { Array<number> } 1115 * @syscap SystemCapability.Location.Location.Gnss 1116 * @since 9 1117 */ 1118 carrierToNoiseDensitys: Array<number>; 1119 1120 /** 1121 * Satellite altitude array. 1122 * 1123 * @type { Array<number> } 1124 * @syscap SystemCapability.Location.Location.Gnss 1125 * @since 9 1126 */ 1127 altitudes: Array<number>; 1128 1129 /** 1130 * Satellite azimuth array. 1131 * 1132 * @type { Array<number> } 1133 * @syscap SystemCapability.Location.Location.Gnss 1134 * @since 9 1135 */ 1136 azimuths: Array<number>; 1137 1138 /** 1139 * Satellite carrier frequency array. 1140 * 1141 * @type { Array<number> } 1142 * @syscap SystemCapability.Location.Location.Gnss 1143 * @since 9 1144 */ 1145 carrierFrequencies: Array<number>; 1146 1147 /** 1148 * Satellite constellation type array. 1149 * 1150 * @type { ?Array<SatelliteConstellationCategory> } 1151 * @syscap SystemCapability.Location.Location.Gnss 1152 * @since 12 1153 */ 1154 satelliteConstellation?: Array<SatelliteConstellationCategory>; 1155 1156 /** 1157 * Satellite additional information array. 1158 * 1159 * @type { ?Array<number> } 1160 * @syscap SystemCapability.Location.Location.Gnss 1161 * @since 12 1162 */ 1163 satelliteAdditionalInfo?: Array<number>; 1164 } 1165 1166 /** 1167 * Parameters for requesting to report cache location information. 1168 * 1169 * @typedef CachedGnssLocationsRequest 1170 * @syscap SystemCapability.Location.Location.Gnss 1171 * @since 9 1172 */ 1173 export interface CachedGnssLocationsRequest { 1174 /** 1175 * GNSS cache location report period. 1176 * 1177 * @type { number } 1178 * @syscap SystemCapability.Location.Location.Gnss 1179 * @since 9 1180 */ 1181 reportingPeriodSec: number; 1182 1183 /** 1184 * Indicates whether to wake up the listener when the GNSS cache location queue is full. 1185 * 1186 * @type { boolean } 1187 * @syscap SystemCapability.Location.Location.Gnss 1188 * @since 9 1189 */ 1190 wakeUpCacheQueueFull: boolean; 1191 } 1192 1193 /** 1194 * Configuring parameters in GNSS geofence requests. 1195 * 1196 * @typedef GnssGeofenceRequest 1197 * @syscap SystemCapability.Location.Location.Geofence 1198 * @since 12 1199 */ 1200 export interface GnssGeofenceRequest { 1201 /** 1202 * Circular fence information. 1203 * 1204 * @type { Geofence } 1205 * @syscap SystemCapability.Location.Location.Geofence 1206 * @since 12 1207 */ 1208 geofence: Geofence; 1209 1210 /** 1211 * Indicates geofence transition status monitored. 1212 * 1213 * @type { Array<GeofenceTransitionEvent> } 1214 * @syscap SystemCapability.Location.Location.Geofence 1215 * @since 12 1216 */ 1217 monitorTransitionEvents: Array<GeofenceTransitionEvent>; 1218 1219 /** 1220 * Indicates the geofence notifications to publish. 1221 * 1222 * @type { ?Array<NotificationRequest> } 1223 * @syscap SystemCapability.Location.Location.Geofence 1224 * @since 12 1225 */ 1226 notifications?: Array<NotificationRequest>; 1227 1228 /** 1229 * Indicates the callback for reporting the geofence transition status. 1230 * 1231 * @type { AsyncCallback<GeofenceTransition> } 1232 * @syscap SystemCapability.Location.Location.Geofence 1233 * @since 12 1234 */ 1235 geofenceTransitionCallback: AsyncCallback<GeofenceTransition>; 1236 } 1237 1238 /** 1239 * Configuring parameters in geofence requests. 1240 * 1241 * @typedef GeofenceRequest 1242 * @syscap SystemCapability.Location.Location.Geofence 1243 * @since 9 1244 */ 1245 export interface GeofenceRequest { 1246 /** 1247 * Indicate the user scenario. 1248 * 1249 * @type { LocationRequestScenario } 1250 * @syscap SystemCapability.Location.Location.Geofence 1251 * @since 9 1252 */ 1253 scenario: LocationRequestScenario; 1254 1255 /** 1256 * Circular fence information. 1257 * 1258 * @type { Geofence } 1259 * @syscap SystemCapability.Location.Location.Geofence 1260 * @since 9 1261 */ 1262 geofence: Geofence; 1263 } 1264 1265 /** 1266 * Circular fence information. 1267 * 1268 * @typedef Geofence 1269 * @syscap SystemCapability.Location.Location.Geofence 1270 * @since 9 1271 */ 1272 export interface Geofence { 1273 /** 1274 * Latitude of the center point of the circular fence. 1275 * 1276 * @type { number } 1277 * @syscap SystemCapability.Location.Location.Geofence 1278 * @since 9 1279 */ 1280 latitude: number; 1281 1282 /** 1283 * Longitude of the center point of the circular fence. 1284 * 1285 * @type { number } 1286 * @syscap SystemCapability.Location.Location.Geofence 1287 * @since 9 1288 */ 1289 longitude: number; 1290 1291 /** 1292 * Coordinate system type. 1293 * 1294 * @type { ?CoordinateSystemType } 1295 * @syscap SystemCapability.Location.Location.Geofence 1296 * @since 12 1297 */ 1298 coordinateSystemType?: CoordinateSystemType; 1299 1300 /** 1301 * Radius of the circular fence. 1302 * 1303 * @type { number } 1304 * @syscap SystemCapability.Location.Location.Geofence 1305 * @since 9 1306 */ 1307 radius: number; 1308 1309 /** 1310 * Expiration of the circular fence. 1311 * 1312 * @type { number } 1313 * @syscap SystemCapability.Location.Location.Geofence 1314 * @since 9 1315 */ 1316 expiration: number; 1317 } 1318 1319 /** 1320 * Configuring parameters in reverse geocode requests. 1321 * 1322 * @typedef ReverseGeoCodeRequest 1323 * @syscap SystemCapability.Location.Location.Geocoder 1324 * @since 9 1325 */ 1326 export interface ReverseGeoCodeRequest { 1327 /** 1328 * Indicates the language area information. 1329 * 1330 * @type { ?string } 1331 * @syscap SystemCapability.Location.Location.Geocoder 1332 * @since 9 1333 */ 1334 locale?: string; 1335 1336 /** 1337 * Indicates the country information. 1338 * 1339 * @type { ?string } 1340 * @syscap SystemCapability.Location.Location.Geocoder 1341 * @since 12 1342 */ 1343 country?: string; 1344 1345 /** 1346 * Latitude for reverse geocoding query. 1347 * 1348 * @type { number } 1349 * @syscap SystemCapability.Location.Location.Geocoder 1350 * @since 9 1351 */ 1352 latitude: number; 1353 1354 /** 1355 * Longitude for reverse geocoding query. 1356 * 1357 * @type { number } 1358 * @syscap SystemCapability.Location.Location.Geocoder 1359 * @since 9 1360 */ 1361 longitude: number; 1362 1363 /** 1364 * Indicates the maximum number of addresses returned by reverse geocoding query. 1365 * 1366 * @type { ?number } 1367 * @syscap SystemCapability.Location.Location.Geocoder 1368 * @since 9 1369 */ 1370 maxItems?: number; 1371 } 1372 1373 /** 1374 * Configuring parameters in geocode requests. 1375 * 1376 * @typedef GeoCodeRequest 1377 * @syscap SystemCapability.Location.Location.Geocoder 1378 * @since 9 1379 */ 1380 export interface GeoCodeRequest { 1381 /** 1382 * Indicates the language area information. 1383 * 1384 * @type { ?string } 1385 * @syscap SystemCapability.Location.Location.Geocoder 1386 * @since 9 1387 */ 1388 locale?: string; 1389 1390 /** 1391 * Indicates the country information. 1392 * 1393 * @type { ?string } 1394 * @syscap SystemCapability.Location.Location.Geocoder 1395 * @since 12 1396 */ 1397 country?: string; 1398 1399 /** 1400 * Address information. 1401 * 1402 * @type { string } 1403 * @syscap SystemCapability.Location.Location.Geocoder 1404 * @since 9 1405 */ 1406 description: string; 1407 1408 /** 1409 * Indicates the maximum number of geocode query results. 1410 * 1411 * @type { ?number } 1412 * @syscap SystemCapability.Location.Location.Geocoder 1413 * @since 9 1414 */ 1415 maxItems?: number; 1416 1417 /** 1418 * Indicates the minimum latitude for geocoding query results. 1419 * 1420 * @type { ?number } 1421 * @syscap SystemCapability.Location.Location.Geocoder 1422 * @since 9 1423 */ 1424 minLatitude?: number; 1425 1426 /** 1427 * Indicates the minimum longitude for geocoding query results. 1428 * 1429 * @type { ?number } 1430 * @syscap SystemCapability.Location.Location.Geocoder 1431 * @since 9 1432 */ 1433 minLongitude?: number; 1434 1435 /** 1436 * Indicates the maximum latitude for geocoding query results. 1437 * 1438 * @type { ?number } 1439 * @syscap SystemCapability.Location.Location.Geocoder 1440 * @since 9 1441 */ 1442 maxLatitude?: number; 1443 1444 /** 1445 * Indicates the maximum longitude for geocoding query results. 1446 * 1447 * @type { ?number } 1448 * @syscap SystemCapability.Location.Location.Geocoder 1449 * @since 9 1450 */ 1451 maxLongitude?: number; 1452 } 1453 1454 /** 1455 * Data struct describes geographic locations. 1456 * 1457 * @typedef GeoAddress 1458 * @syscap SystemCapability.Location.Location.Geocoder 1459 * @since 9 1460 */ 1461 export interface GeoAddress { 1462 /** 1463 * Indicates latitude information. 1464 * A positive value indicates north latitude, 1465 * and a negative value indicates south latitude. 1466 * 1467 * @type { ?number } 1468 * @syscap SystemCapability.Location.Location.Geocoder 1469 * @since 9 1470 */ 1471 latitude?: number; 1472 1473 /** 1474 * Indicates longitude information. 1475 * A positive value indicates east longitude , 1476 * and a negative value indicates west longitude. 1477 * 1478 * @type { ?number } 1479 * @syscap SystemCapability.Location.Location.Geocoder 1480 * @since 9 1481 */ 1482 longitude?: number; 1483 1484 /** 1485 * Indicates language used for the location description. 1486 * zh indicates Chinese, and en indicates English. 1487 * 1488 * @type { ?string } 1489 * @syscap SystemCapability.Location.Location.Geocoder 1490 * @since 9 1491 */ 1492 locale?: string; 1493 1494 /** 1495 * Indicates detailed address information. 1496 * 1497 * @type { ?string } 1498 * @syscap SystemCapability.Location.Location.Geocoder 1499 * @since 9 1500 */ 1501 placeName?: string; 1502 1503 /** 1504 * Indicates country code. 1505 * 1506 * @type { ?string } 1507 * @syscap SystemCapability.Location.Location.Geocoder 1508 * @since 9 1509 */ 1510 countryCode?: string; 1511 1512 /** 1513 * Indicates country name. 1514 * 1515 * @type { ?string } 1516 * @syscap SystemCapability.Location.Location.Geocoder 1517 * @since 9 1518 */ 1519 countryName?: string; 1520 1521 /** 1522 * Indicates administrative region name. 1523 * 1524 * @type { ?string } 1525 * @syscap SystemCapability.Location.Location.Geocoder 1526 * @since 9 1527 */ 1528 administrativeArea?: string; 1529 1530 /** 1531 * Indicates sub-administrative region name. 1532 * 1533 * @type { ?string } 1534 * @syscap SystemCapability.Location.Location.Geocoder 1535 * @since 9 1536 */ 1537 subAdministrativeArea?: string; 1538 1539 /** 1540 * Indicates locality information. 1541 * 1542 * @type { ?string } 1543 * @syscap SystemCapability.Location.Location.Geocoder 1544 * @since 9 1545 */ 1546 locality?: string; 1547 1548 /** 1549 * Indicates sub-locality information. 1550 * 1551 * @type { ?string } 1552 * @syscap SystemCapability.Location.Location.Geocoder 1553 * @since 9 1554 */ 1555 subLocality?: string; 1556 1557 /** 1558 * Indicates road name. 1559 * 1560 * @type { ?string } 1561 * @syscap SystemCapability.Location.Location.Geocoder 1562 * @since 9 1563 */ 1564 roadName?: string; 1565 1566 /** 1567 * Indicates auxiliary road information. 1568 * 1569 * @type { ?string } 1570 * @syscap SystemCapability.Location.Location.Geocoder 1571 * @since 9 1572 */ 1573 subRoadName?: string; 1574 1575 /** 1576 * Indicates house information. 1577 * 1578 * @type { ?string } 1579 * @syscap SystemCapability.Location.Location.Geocoder 1580 * @since 9 1581 */ 1582 premises?: string; 1583 1584 /** 1585 * Indicates postal code. 1586 * 1587 * @type { ?string } 1588 * @syscap SystemCapability.Location.Location.Geocoder 1589 * @since 9 1590 */ 1591 postalCode?: string; 1592 1593 /** 1594 * Indicates phone number. 1595 * 1596 * @type { ?string } 1597 * @syscap SystemCapability.Location.Location.Geocoder 1598 * @since 9 1599 */ 1600 phoneNumber?: string; 1601 1602 /** 1603 * Indicates website URL. 1604 * 1605 * @type { ?string } 1606 * @syscap SystemCapability.Location.Location.Geocoder 1607 * @since 9 1608 */ 1609 addressUrl?: string; 1610 1611 /** 1612 * Indicates additional information. 1613 * 1614 * @type { ?Array<string> } 1615 * @syscap SystemCapability.Location.Location.Geocoder 1616 * @since 9 1617 */ 1618 descriptions?: Array<string>; 1619 1620 /** 1621 * Indicates the amount of additional descriptive information. 1622 * 1623 * @type { ?number } 1624 * @syscap SystemCapability.Location.Location.Geocoder 1625 * @since 9 1626 */ 1627 descriptionsSize?: number; 1628 1629 /** 1630 * Indicates whether it is an mock GeoAddress 1631 * 1632 * @type { ?Boolean } 1633 * @syscap SystemCapability.Location.Location.Geocoder 1634 * @systemapi 1635 * @since 9 1636 */ 1637 isFromMock?: Boolean; 1638 } 1639 1640 /** 1641 * Configuring parameters in location requests. 1642 * 1643 * @typedef LocationRequest 1644 * @syscap SystemCapability.Location.Location.Core 1645 * @since 9 1646 */ 1647 /** 1648 * Configuring parameters in location requests. 1649 * 1650 * @typedef LocationRequest 1651 * @syscap SystemCapability.Location.Location.Core 1652 * @atomicservice 1653 * @since 11 1654 */ 1655 export interface LocationRequest { 1656 /** 1657 * Priority of the location request. 1658 * 1659 * @type { ?LocationRequestPriority } 1660 * @syscap SystemCapability.Location.Location.Core 1661 * @since 9 1662 */ 1663 /** 1664 * Priority of the location request. 1665 * 1666 * @type { ?LocationRequestPriority } 1667 * @syscap SystemCapability.Location.Location.Core 1668 * @atomicservice 1669 * @since 11 1670 */ 1671 priority?: LocationRequestPriority; 1672 1673 /** 1674 * User scenario of the location request. 1675 * 1676 * @type { ?LocationRequestScenario } 1677 * @syscap SystemCapability.Location.Location.Core 1678 * @since 9 1679 */ 1680 /** 1681 * User scenario of the location request. 1682 * 1683 * @type { ?LocationRequestScenario } 1684 * @syscap SystemCapability.Location.Location.Core 1685 * @atomicservice 1686 * @since 11 1687 */ 1688 scenario?: LocationRequestScenario; 1689 1690 /** 1691 * Location report interval. 1692 * 1693 * @type { ?number } 1694 * @syscap SystemCapability.Location.Location.Core 1695 * @since 9 1696 */ 1697 /** 1698 * Location report interval. 1699 * 1700 * @type { ?number } 1701 * @syscap SystemCapability.Location.Location.Core 1702 * @atomicservice 1703 * @since 11 1704 */ 1705 timeInterval?: number; 1706 1707 /** 1708 * Location report distance interval. 1709 * 1710 * @type { ?number } 1711 * @syscap SystemCapability.Location.Location.Core 1712 * @since 9 1713 */ 1714 /** 1715 * Location report distance interval. 1716 * 1717 * @type { ?number } 1718 * @syscap SystemCapability.Location.Location.Core 1719 * @atomicservice 1720 * @since 11 1721 */ 1722 distanceInterval?: number; 1723 1724 /** 1725 * Accuracy requirements for reporting locations. 1726 * 1727 * @type { ?number } 1728 * @syscap SystemCapability.Location.Location.Core 1729 * @since 9 1730 */ 1731 /** 1732 * Accuracy requirements for reporting locations. 1733 * 1734 * @type { ?number } 1735 * @syscap SystemCapability.Location.Location.Core 1736 * @atomicservice 1737 * @since 11 1738 */ 1739 maxAccuracy?: number; 1740 } 1741 1742 /** 1743 * Configuring parameters in current location requests. 1744 * 1745 * @typedef CurrentLocationRequest 1746 * @syscap SystemCapability.Location.Location.Core 1747 * @since 9 1748 */ 1749 /** 1750 * Configuring parameters in current location requests. 1751 * 1752 * @typedef CurrentLocationRequest 1753 * @syscap SystemCapability.Location.Location.Core 1754 * @atomicservice 1755 * @since 11 1756 */ 1757 export interface CurrentLocationRequest { 1758 /** 1759 * Priority of the location request. 1760 * 1761 * @type { ?LocationRequestPriority } 1762 * @syscap SystemCapability.Location.Location.Core 1763 * @since 9 1764 */ 1765 /** 1766 * Priority of the location request. 1767 * 1768 * @type { ?LocationRequestPriority } 1769 * @syscap SystemCapability.Location.Location.Core 1770 * @atomicservice 1771 * @since 11 1772 */ 1773 priority?: LocationRequestPriority; 1774 1775 /** 1776 * User scenario of the location request. 1777 * 1778 * @type { ?LocationRequestScenario } 1779 * @syscap SystemCapability.Location.Location.Core 1780 * @since 9 1781 */ 1782 /** 1783 * User scenario of the location request. 1784 * 1785 * @type { ?LocationRequestScenario } 1786 * @syscap SystemCapability.Location.Location.Core 1787 * @atomicservice 1788 * @since 11 1789 */ 1790 scenario?: LocationRequestScenario; 1791 1792 /** 1793 * Accuracy requirements for reporting locations. 1794 * 1795 * @type { ?number } 1796 * @syscap SystemCapability.Location.Location.Core 1797 * @since 9 1798 */ 1799 /** 1800 * Accuracy requirements for reporting locations. 1801 * 1802 * @type { ?number } 1803 * @syscap SystemCapability.Location.Location.Core 1804 * @atomicservice 1805 * @since 11 1806 */ 1807 maxAccuracy?: number; 1808 1809 /** 1810 * Timeout interval of a single location request. 1811 * 1812 * @type { ?number } 1813 * @syscap SystemCapability.Location.Location.Core 1814 * @since 9 1815 */ 1816 /** 1817 * Timeout interval of a single location request. 1818 * 1819 * @type { ?number } 1820 * @syscap SystemCapability.Location.Location.Core 1821 * @atomicservice 1822 * @since 11 1823 */ 1824 timeoutMs?: number; 1825 } 1826 1827 /** 1828 * Geofence transition status. 1829 * 1830 * @typedef GeofenceTransition 1831 * @syscap SystemCapability.Location.Location.Geofence 1832 * @since 12 1833 */ 1834 export interface GeofenceTransition { 1835 /** 1836 * ID of the geofence. 1837 * 1838 * @type { number } 1839 * @syscap SystemCapability.Location.Location.Geofence 1840 * @since 12 1841 */ 1842 geofenceId: number; 1843 1844 /** 1845 * Indicates the geofence transition status. 1846 * 1847 * @type { GeofenceTransitionEvent } 1848 * @syscap SystemCapability.Location.Location.Geofence 1849 * @since 12 1850 */ 1851 transitionEvent: GeofenceTransitionEvent; 1852 } 1853 1854 /** 1855 * Configuring parameters in continuous location requests. 1856 * 1857 * @typedef ContinuousLocationRequest 1858 * @syscap SystemCapability.Location.Location.Core 1859 * @atomicservice 1860 * @since 12 1861 */ 1862 export interface ContinuousLocationRequest { 1863 /** 1864 * Location report interval, in seconds. 1865 * 1866 * @type { number } 1867 * @syscap SystemCapability.Location.Location.Core 1868 * @atomicservice 1869 * @since 12 1870 */ 1871 interval: number; 1872 1873 /** 1874 * Location scenario. You can select a user activity scenario or power consumption scenario. 1875 * 1876 * @type { UserActivityScenario | PowerConsumptionScenario } 1877 * @syscap SystemCapability.Location.Location.Core 1878 * @atomicservice 1879 * @since 12 1880 */ 1881 locationScenario: UserActivityScenario | PowerConsumptionScenario; 1882 } 1883 1884 /** 1885 * Configuring parameters in single location requests. 1886 * 1887 * @typedef SingleLocationRequest 1888 * @syscap SystemCapability.Location.Location.Core 1889 * @atomicservice 1890 * @since 12 1891 */ 1892 export interface SingleLocationRequest { 1893 /** 1894 * Priority of the location request. 1895 * 1896 * @type { LocatingPriority } 1897 * @syscap SystemCapability.Location.Location.Core 1898 * @atomicservice 1899 * @since 12 1900 */ 1901 locatingPriority: LocatingPriority; 1902 1903 /** 1904 * Timeout of a single location request, in milliseconds. 1905 * 1906 * @type { number } 1907 * @syscap SystemCapability.Location.Location.Core 1908 * @atomicservice 1909 * @since 12 1910 */ 1911 locatingTimeoutMs: number; 1912 } 1913 1914 /** 1915 * Provides information about geographic locations. 1916 * 1917 * @typedef Location 1918 * @syscap SystemCapability.Location.Location.Core 1919 * @since 9 1920 */ 1921 /** 1922 * Provides information about geographic locations. 1923 * 1924 * @typedef Location 1925 * @syscap SystemCapability.Location.Location.Core 1926 * @atomicservice 1927 * @since 11 1928 */ 1929 export interface Location { 1930 /** 1931 * Indicates latitude information. 1932 * A positive value indicates north latitude, 1933 * and a negative value indicates south latitude. 1934 * 1935 * @type { number } 1936 * @syscap SystemCapability.Location.Location.Core 1937 * @since 9 1938 */ 1939 /** 1940 * Indicates latitude information. 1941 * A positive value indicates north latitude, 1942 * and a negative value indicates south latitude. 1943 * 1944 * @type { number } 1945 * @syscap SystemCapability.Location.Location.Core 1946 * @atomicservice 1947 * @since 11 1948 */ 1949 latitude: number; 1950 1951 /** 1952 * Indicates Longitude information. 1953 * A positive value indicates east longitude , 1954 * and a negative value indicates west longitude. 1955 * 1956 * @type { number } 1957 * @syscap SystemCapability.Location.Location.Core 1958 * @since 9 1959 */ 1960 /** 1961 * Indicates Longitude information. 1962 * A positive value indicates east longitude , 1963 * and a negative value indicates west longitude. 1964 * 1965 * @type { number } 1966 * @syscap SystemCapability.Location.Location.Core 1967 * @atomicservice 1968 * @since 11 1969 */ 1970 longitude: number; 1971 1972 /** 1973 * Indicates location altitude, in meters. 1974 * 1975 * @type { number } 1976 * @syscap SystemCapability.Location.Location.Core 1977 * @since 9 1978 */ 1979 /** 1980 * Indicates location altitude, in meters. 1981 * 1982 * @type { number } 1983 * @syscap SystemCapability.Location.Location.Core 1984 * @atomicservice 1985 * @since 11 1986 */ 1987 altitude: number; 1988 1989 /** 1990 * Indicates location accuracy, in meters. 1991 * 1992 * @type { number } 1993 * @syscap SystemCapability.Location.Location.Core 1994 * @since 9 1995 */ 1996 /** 1997 * Indicates location accuracy, in meters. 1998 * 1999 * @type { number } 2000 * @syscap SystemCapability.Location.Location.Core 2001 * @atomicservice 2002 * @since 11 2003 */ 2004 accuracy: number; 2005 2006 /** 2007 * Indicates speed, in m/s. 2008 * 2009 * @type { number } 2010 * @syscap SystemCapability.Location.Location.Core 2011 * @since 9 2012 */ 2013 /** 2014 * Indicates speed, in m/s. 2015 * 2016 * @type { number } 2017 * @syscap SystemCapability.Location.Location.Core 2018 * @atomicservice 2019 * @since 11 2020 */ 2021 speed: number; 2022 2023 /** 2024 * Indicates location timestamp in the UTC format. 2025 * 2026 * @type { number } 2027 * @syscap SystemCapability.Location.Location.Core 2028 * @since 9 2029 */ 2030 /** 2031 * Indicates location timestamp in the UTC format. 2032 * 2033 * @type { number } 2034 * @syscap SystemCapability.Location.Location.Core 2035 * @atomicservice 2036 * @since 11 2037 */ 2038 timeStamp: number; 2039 2040 /** 2041 * Indicates direction information. 2042 * 2043 * @type { number } 2044 * @syscap SystemCapability.Location.Location.Core 2045 * @since 9 2046 */ 2047 /** 2048 * Indicates direction information. 2049 * 2050 * @type { number } 2051 * @syscap SystemCapability.Location.Location.Core 2052 * @atomicservice 2053 * @since 11 2054 */ 2055 direction: number; 2056 2057 /** 2058 * Indicates location timestamp since boot. 2059 * 2060 * @type { number } 2061 * @syscap SystemCapability.Location.Location.Core 2062 * @since 9 2063 */ 2064 /** 2065 * Indicates location timestamp since boot. 2066 * 2067 * @type { number } 2068 * @syscap SystemCapability.Location.Location.Core 2069 * @atomicservice 2070 * @since 11 2071 */ 2072 timeSinceBoot: number; 2073 2074 /** 2075 * Indicates additional information. 2076 * 2077 * @type { ?Array<string> } 2078 * @syscap SystemCapability.Location.Location.Core 2079 * @since 9 2080 */ 2081 /** 2082 * Indicates additional information. 2083 * 2084 * @type { ?Array<string> } 2085 * @syscap SystemCapability.Location.Location.Core 2086 * @atomicservice 2087 * @since 11 2088 */ 2089 additions?: Array<string>; 2090 2091 /** 2092 * Indicates additional information map. 2093 * 2094 * @type { ?Map<string, string> } 2095 * @syscap SystemCapability.Location.Location.Core 2096 * @atomicservice 2097 * @since 12 2098 */ 2099 additionsMap?: Map<string, string>; 2100 2101 /** 2102 * Indicates the amount of additional descriptive information. 2103 * 2104 * @type { ?number } 2105 * @syscap SystemCapability.Location.Location.Core 2106 * @since 9 2107 */ 2108 /** 2109 * Indicates the amount of additional descriptive information. 2110 * 2111 * @type { ?number } 2112 * @syscap SystemCapability.Location.Location.Core 2113 * @atomicservice 2114 * @since 11 2115 */ 2116 additionSize?: number; 2117 2118 /** 2119 * Indicates whether it is an mock location. 2120 * 2121 * @type { ?Boolean } 2122 * @syscap SystemCapability.Location.Location.Core 2123 * @systemapi 2124 * @since 9 2125 */ 2126 isFromMock?: Boolean; 2127 2128 /** 2129 * Indicates vertical position accuracy in meters. 2130 * 2131 * @type { ?number } 2132 * @syscap SystemCapability.Location.Location.Core 2133 * @atomicservice 2134 * @since 12 2135 */ 2136 altitudeAccuracy?: number; 2137 2138 /** 2139 * Indicates speed accuracy in meter per seconds. 2140 * 2141 * @type { ?number } 2142 * @syscap SystemCapability.Location.Location.Core 2143 * @atomicservice 2144 * @since 12 2145 */ 2146 speedAccuracy?: number; 2147 2148 /** 2149 * Indicates direction accuracy in degrees. 2150 * 2151 * @type { ?number } 2152 * @syscap SystemCapability.Location.Location.Core 2153 * @atomicservice 2154 * @since 12 2155 */ 2156 directionAccuracy?: number; 2157 2158 /** 2159 * Time uncertainty Of timeSinceBoot in nanosecond. 2160 * 2161 * @type { ?number } 2162 * @syscap SystemCapability.Location.Location.Core 2163 * @atomicservice 2164 * @since 12 2165 */ 2166 uncertaintyOfTimeSinceBoot?: number; 2167 2168 /** 2169 * Indicates the source of the location. 2170 * 2171 * @type { ?LocationSourceType } 2172 * @syscap SystemCapability.Location.Location.Core 2173 * @atomicservice 2174 * @since 12 2175 */ 2176 sourceType?: LocationSourceType; 2177 } 2178 2179 /** 2180 * Describes the request parameters for obtaining the data required for locating. 2181 * @typedef LocatingRequiredDataConfig 2182 * @syscap SystemCapability.Location.Location.Core 2183 * @systemapi 2184 * @since 10 2185 */ 2186 export interface LocatingRequiredDataConfig { 2187 /** 2188 * Indicates the type of locating required data. 2189 * 2190 * @type {LocatingRequiredDataType} 2191 * @syscap SystemCapability.Location.Location.Core 2192 * @systemapi 2193 * @since 10 2194 */ 2195 type: LocatingRequiredDataType; 2196 2197 /** 2198 * Indicates whether to start scanning. 2199 * 2200 * @type {boolean} 2201 * @syscap SystemCapability.Location.Location.Core 2202 * @systemapi 2203 * @since 10 2204 */ 2205 needStartScan: boolean; 2206 2207 /** 2208 * Indicates the interval between scans. The unit is millisecond. 2209 * This parameter needs to be set only when scanning information is continuously monitored. 2210 * 2211 * @type {?number} 2212 * @syscap SystemCapability.Location.Location.Core 2213 * @systemapi 2214 * @since 10 2215 */ 2216 scanInterval?: number; 2217 2218 /** 2219 * Indicates the timeout period of a single scan. The unit is millisecond. The default value is 10000. 2220 * This parameter needs to be set only when getLocatingRequiredData is used. 2221 * 2222 * @type {?number} 2223 * @syscap SystemCapability.Location.Location.Core 2224 * @systemapi 2225 * @since 10 2226 */ 2227 scanTimeout?: number; 2228 } 2229 2230 /** 2231 * Describes the structure of the data required for locating. 2232 * @typedef LocatingRequiredData 2233 * @syscap SystemCapability.Location.Location.Core 2234 * @systemapi 2235 * @since 10 2236 */ 2237 export interface LocatingRequiredData { 2238 /** 2239 * WiFi scan info. 2240 * 2241 * @type {?WifiScanInfo} 2242 * @syscap SystemCapability.Location.Location.Core 2243 * @systemapi 2244 * @since 10 2245 */ 2246 wifiData?: WifiScanInfo; 2247 2248 /** 2249 * Bluetooth scan info. 2250 * 2251 * @type {?BluetoothScanInfo} 2252 * @syscap SystemCapability.Location.Location.Core 2253 * @systemapi 2254 * @since 10 2255 */ 2256 bluetoothData?: BluetoothScanInfo; 2257 } 2258 2259 /** 2260 * Describes the scanned WiFi information. 2261 * @typedef WifiScanInfo 2262 * @syscap SystemCapability.Location.Location.Core 2263 * @systemapi 2264 * @since 10 2265 */ 2266 export interface WifiScanInfo { 2267 /** 2268 * WiFi SSID: the maximum length is 32. 2269 * 2270 * @type {string} 2271 * @syscap SystemCapability.Location.Location.Core 2272 * @systemapi 2273 * @since 10 2274 */ 2275 ssid: string; 2276 2277 /** 2278 * WiFi bssid(MAC): the length is 6. 2279 * 2280 * @type {string} 2281 * @syscap SystemCapability.Location.Location.Core 2282 * @systemapi 2283 * @since 10 2284 */ 2285 bssid: string; 2286 2287 /** 2288 * Received signal strength indicator (RSSI). 2289 * 2290 * @type {number} 2291 * @syscap SystemCapability.Location.Location.Core 2292 * @systemapi 2293 * @since 10 2294 */ 2295 rssi: number; 2296 2297 /** 2298 * Frequency 2299 * 2300 * @type {number} 2301 * @syscap SystemCapability.Location.Location.Core 2302 * @systemapi 2303 * @since 10 2304 */ 2305 frequency: number; 2306 2307 /** 2308 * Time stamp. 2309 * 2310 * @type {number} 2311 * @syscap SystemCapability.Location.Location.Core 2312 * @systemapi 2313 * @since 10 2314 */ 2315 timestamp: number; 2316 } 2317 2318 /** 2319 * Describes the contents of the Bluetooth scan results. 2320 * 2321 * @typedef BluetoothScanInfo 2322 * @syscap SystemCapability.Location.Location.Core 2323 * @systemapi 2324 * @since 10 2325 */ 2326 export interface BluetoothScanInfo { 2327 /** 2328 * The local name of the device. 2329 * 2330 * @type {string} 2331 * @syscap SystemCapability.Location.Location.Core 2332 * @systemapi 2333 * @since 10 2334 */ 2335 deviceName: string; 2336 2337 /** 2338 * Mac address of the scanned device. 2339 * 2340 * @type {string} 2341 * @syscap SystemCapability.Location.Location.Core 2342 * @systemapi 2343 * @since 10 2344 */ 2345 macAddress: string; 2346 2347 /** 2348 * RSSI of the remote device. 2349 * 2350 * @type {number} 2351 * @syscap SystemCapability.Location.Location.Core 2352 * @systemapi 2353 * @since 10 2354 */ 2355 rssi: number; 2356 2357 /** 2358 * Time stamp. 2359 * 2360 * @type {number} 2361 * @syscap SystemCapability.Location.Location.Core 2362 * @systemapi 2363 * @since 10 2364 */ 2365 timestamp: number; 2366 } 2367 2368 /** 2369 * Enum for the source of the location. 2370 * 2371 * @enum { number } 2372 * @syscap SystemCapability.Location.Location.Core 2373 * @atomicservice 2374 * @since 12 2375 */ 2376 export enum LocationSourceType { 2377 /** 2378 * The location is obtained from the GNSS. 2379 * 2380 * @syscap SystemCapability.Location.Location.Core 2381 * @atomicservice 2382 * @since 12 2383 */ 2384 GNSS = 1, 2385 2386 /** 2387 * The location comes from the network positioning technology. 2388 * 2389 * @syscap SystemCapability.Location.Location.Core 2390 * @atomicservice 2391 * @since 12 2392 */ 2393 NETWORK = 2, 2394 2395 /** 2396 * The location comes from the indoor positioning technology. 2397 * 2398 * @syscap SystemCapability.Location.Location.Core 2399 * @atomicservice 2400 * @since 12 2401 */ 2402 INDOOR = 3, 2403 2404 /** 2405 * The location comes from the GNSS RTK technology. 2406 * 2407 * @syscap SystemCapability.Location.Location.Core 2408 * @atomicservice 2409 * @since 12 2410 */ 2411 RTK = 4 2412 } 2413 2414 /** 2415 * Enum for coordinate system type. 2416 * 2417 * @enum { number } 2418 * @syscap SystemCapability.Location.Location.Geofence 2419 * @since 12 2420 */ 2421 export enum CoordinateSystemType { 2422 /** 2423 * WGS84 coordinates system. 2424 * 2425 * @syscap SystemCapability.Location.Location.Geofence 2426 * @since 12 2427 */ 2428 WGS84 = 1, 2429 2430 /** 2431 * GCJ-02 coordinates system. 2432 * 2433 * @syscap SystemCapability.Location.Location.Geofence 2434 * @since 12 2435 */ 2436 GCJ02 = 2 2437 } 2438 2439 /** 2440 * Enum for location icon status. 2441 * 2442 * @enum { number } 2443 * @syscap SystemCapability.Location.Location.Core 2444 * @systemapi 2445 * @since 12 2446 */ 2447 export enum LocationIconStatus { 2448 /** 2449 * The locating service is not started. 2450 * 2451 * @syscap SystemCapability.Location.Location.Core 2452 * @systemapi 2453 * @since 12 2454 */ 2455 LOCATING_NOT_STARTED = 0, 2456 2457 /** 2458 * The normal locating service is started. 2459 * 2460 * @syscap SystemCapability.Location.Location.Core 2461 * @systemapi 2462 * @since 12 2463 */ 2464 LOCATING_STARTED = 1, 2465 2466 /** 2467 * The HD locating service(RTK) is started. 2468 * 2469 * @syscap SystemCapability.Location.Location.Core 2470 * @systemapi 2471 * @since 12 2472 */ 2473 HD_LOCATING_STARTED = 2 2474 } 2475 2476 /** 2477 * Enum for location error code. 2478 * 2479 * @enum { number } 2480 * @syscap SystemCapability.Location.Location.Core 2481 * @atomicservice 2482 * @since 12 2483 */ 2484 export enum LocationError { 2485 /** 2486 * Default cause for location failure. 2487 * 2488 * @syscap SystemCapability.Location.Location.Core 2489 * @atomicservice 2490 * @since 12 2491 */ 2492 LOCATING_FAILED_DEFAULT = -1, 2493 2494 /** 2495 * Locating failed because the location permission fails to be verified. 2496 * 2497 * @syscap SystemCapability.Location.Location.Core 2498 * @atomicservice 2499 * @since 12 2500 */ 2501 LOCATING_FAILED_LOCATION_PERMISSION_DENIED = -2, 2502 2503 /** 2504 * Locating failed because the app is in the background and the background location permission verification failed. 2505 * 2506 * @syscap SystemCapability.Location.Location.Core 2507 * @atomicservice 2508 * @since 12 2509 */ 2510 LOCATING_FAILED_BACKGROUND_PERMISSION_DENIED = -3, 2511 2512 /** 2513 * Locating failed because the location switch is turned off. 2514 * 2515 * @syscap SystemCapability.Location.Location.Core 2516 * @atomicservice 2517 * @since 12 2518 */ 2519 LOCATING_FAILED_LOCATION_SWITCH_OFF = -4, 2520 2521 /** 2522 * Locating failed because internet access failure. 2523 * 2524 * @syscap SystemCapability.Location.Location.Core 2525 * @atomicservice 2526 * @since 12 2527 */ 2528 LOCATING_FAILED_INTERNET_ACCESS_FAILURE = -5 2529 } 2530 2531 /** 2532 * Enum for geofence transition status. 2533 * 2534 * @enum { number } 2535 * @syscap SystemCapability.Location.Location.Geofence 2536 * @since 12 2537 */ 2538 export enum GeofenceTransitionEvent { 2539 /** 2540 * The device is within the geofence. 2541 * 2542 * @syscap SystemCapability.Location.Location.Geofence 2543 * @since 12 2544 */ 2545 GEOFENCE_TRANSITION_EVENT_ENTER = 1, 2546 2547 /** 2548 * The device is out of the geofence. 2549 * 2550 * @syscap SystemCapability.Location.Location.Geofence 2551 * @since 12 2552 */ 2553 GEOFENCE_TRANSITION_EVENT_EXIT = 2, 2554 2555 /** 2556 * The device is in the geographical fence for a period of time. 2557 * 2558 * @syscap SystemCapability.Location.Location.Geofence 2559 * @since 12 2560 */ 2561 GEOFENCE_TRANSITION_EVENT_DWELL = 4 2562 } 2563 2564 /** 2565 * Enum for satellite constellation category. 2566 * 2567 * @enum { number } 2568 * @syscap SystemCapability.Location.Location.Gnss 2569 * @since 12 2570 */ 2571 export enum SatelliteConstellationCategory { 2572 /** 2573 * Invalid value. 2574 * 2575 * @syscap SystemCapability.Location.Location.Gnss 2576 * @since 12 2577 */ 2578 CONSTELLATION_CATEGORY_UNKNOWN = 0, 2579 2580 /** 2581 * GPS. 2582 * 2583 * @syscap SystemCapability.Location.Location.Gnss 2584 * @since 12 2585 */ 2586 CONSTELLATION_CATEGORY_GPS = 1, 2587 2588 /** 2589 * SBAS. 2590 * 2591 * @syscap SystemCapability.Location.Location.Gnss 2592 * @since 12 2593 */ 2594 CONSTELLATION_CATEGORY_SBAS = 2, 2595 2596 /** 2597 * GLONASS. 2598 * 2599 * @syscap SystemCapability.Location.Location.Gnss 2600 * @since 12 2601 */ 2602 CONSTELLATION_CATEGORY_GLONASS = 3, 2603 2604 /** 2605 * QZSS. 2606 * 2607 * @syscap SystemCapability.Location.Location.Gnss 2608 * @since 12 2609 */ 2610 CONSTELLATION_CATEGORY_QZSS = 4, 2611 2612 /** 2613 * BEIDOU. 2614 * 2615 * @syscap SystemCapability.Location.Location.Gnss 2616 * @since 12 2617 */ 2618 CONSTELLATION_CATEGORY_BEIDOU = 5, 2619 2620 /** 2621 * GALILEO. 2622 * 2623 * @syscap SystemCapability.Location.Location.Gnss 2624 * @since 12 2625 */ 2626 CONSTELLATION_CATEGORY_GALILEO = 6, 2627 2628 /** 2629 * IRNSS. 2630 * 2631 * @syscap SystemCapability.Location.Location.Gnss 2632 * @since 12 2633 */ 2634 CONSTELLATION_CATEGORY_IRNSS = 7 2635 } 2636 2637 /** 2638 * Enum for satellite additional information. 2639 * 2640 * @enum { number } 2641 * @syscap SystemCapability.Location.Location.Gnss 2642 * @since 12 2643 */ 2644 export enum SatelliteAdditionalInfo { 2645 /** 2646 * Default value. 2647 * 2648 * @syscap SystemCapability.Location.Location.Gnss 2649 * @since 12 2650 */ 2651 SATELLITES_ADDITIONAL_INFO_NULL = 0, 2652 2653 /** 2654 * Ephemeris data exist. 2655 * 2656 * @syscap SystemCapability.Location.Location.Gnss 2657 * @since 12 2658 */ 2659 SATELLITES_ADDITIONAL_INFO_EPHEMERIS_DATA_EXIST = 1, 2660 2661 /** 2662 * Almanac data exist. 2663 * 2664 * @syscap SystemCapability.Location.Location.Gnss 2665 * @since 12 2666 */ 2667 SATELLITES_ADDITIONAL_INFO_ALMANAC_DATA_EXIST = 2, 2668 2669 /** 2670 * This satellite is being used in location fix. 2671 * 2672 * @syscap SystemCapability.Location.Location.Gnss 2673 * @since 12 2674 */ 2675 SATELLITES_ADDITIONAL_INFO_USED_IN_FIX = 4, 2676 2677 /** 2678 * Carrier frequency exist. 2679 * 2680 * @syscap SystemCapability.Location.Location.Gnss 2681 * @since 12 2682 */ 2683 SATELLITES_ADDITIONAL_INFO_CARRIER_FREQUENCY_EXIST = 8 2684 } 2685 2686 /** 2687 * Enum for user activity scenario. 2688 * 2689 * @enum { number } 2690 * @syscap SystemCapability.Location.Location.Core 2691 * @atomicservice 2692 * @since 12 2693 */ 2694 export enum UserActivityScenario { 2695 /** 2696 * Navigation scenario. High positioning precision and real-time performance are required. 2697 * 2698 * @syscap SystemCapability.Location.Location.Core 2699 * @atomicservice 2700 * @since 12 2701 */ 2702 NAVIGATION = 0x401, 2703 2704 /** 2705 * Sport scenario. High positioning precision is required. 2706 * 2707 * @syscap SystemCapability.Location.Location.Core 2708 * @atomicservice 2709 * @since 12 2710 */ 2711 SPORT = 0x402, 2712 2713 /** 2714 * Transport scenario. High positioning precision and real-time performance are required. 2715 * 2716 * @syscap SystemCapability.Location.Location.Core 2717 * @atomicservice 2718 * @since 12 2719 */ 2720 TRANSPORT = 0x403, 2721 2722 /** 2723 * Daily life scenarios. Low requirements on positioning precision. 2724 * 2725 * @syscap SystemCapability.Location.Location.Core 2726 * @atomicservice 2727 * @since 12 2728 */ 2729 DAILY_LIFE_SERVICE = 0x404 2730 } 2731 2732 /** 2733 * Enum for locating priority. 2734 * 2735 * @enum { number } 2736 * @syscap SystemCapability.Location.Location.Core 2737 * @atomicservice 2738 * @since 12 2739 */ 2740 export enum LocatingPriority { 2741 /** 2742 * Preferentially ensure the highest locating accuracy. 2743 * 2744 * @syscap SystemCapability.Location.Location.Core 2745 * @atomicservice 2746 * @since 12 2747 */ 2748 PRIORITY_ACCURACY = 0x501, 2749 2750 /** 2751 * Preferentially ensure the fastest locating speed. 2752 * 2753 * @syscap SystemCapability.Location.Location.Core 2754 * @atomicservice 2755 * @since 12 2756 */ 2757 PRIORITY_LOCATING_SPEED = 0x502 2758 } 2759 2760 /** 2761 * Enum for location priority. 2762 * 2763 * @enum { number } 2764 * @syscap SystemCapability.Location.Location.Core 2765 * @since 9 2766 */ 2767 /** 2768 * Enum for location priority. 2769 * 2770 * @enum { number } 2771 * @syscap SystemCapability.Location.Location.Core 2772 * @atomicservice 2773 * @since 11 2774 */ 2775 export enum LocationRequestPriority { 2776 /** 2777 * Default priority. 2778 * 2779 * @syscap SystemCapability.Location.Location.Core 2780 * @since 9 2781 */ 2782 /** 2783 * Default priority. 2784 * 2785 * @syscap SystemCapability.Location.Location.Core 2786 * @atomicservice 2787 * @since 11 2788 */ 2789 UNSET = 0x200, 2790 2791 /** 2792 * Preferentially ensure the locating accuracy. 2793 * 2794 * @syscap SystemCapability.Location.Location.Core 2795 * @since 9 2796 */ 2797 /** 2798 * Preferentially ensure the locating accuracy. 2799 * 2800 * @syscap SystemCapability.Location.Location.Core 2801 * @atomicservice 2802 * @since 11 2803 */ 2804 ACCURACY, 2805 2806 /** 2807 * Preferentially ensure low power consumption for locating. 2808 * 2809 * @syscap SystemCapability.Location.Location.Core 2810 * @since 9 2811 */ 2812 /** 2813 * Preferentially ensure low power consumption for locating. 2814 * 2815 * @syscap SystemCapability.Location.Location.Core 2816 * @atomicservice 2817 * @since 11 2818 */ 2819 LOW_POWER, 2820 2821 /** 2822 * Preferentially ensure that the first location is time-consuming. 2823 * 2824 * @syscap SystemCapability.Location.Location.Core 2825 * @since 9 2826 */ 2827 /** 2828 * Preferentially ensure that the first location is time-consuming. 2829 * 2830 * @syscap SystemCapability.Location.Location.Core 2831 * @atomicservice 2832 * @since 11 2833 */ 2834 FIRST_FIX 2835 } 2836 2837 /** 2838 * Enum for location scenario. 2839 * 2840 * @enum { number } 2841 * @syscap SystemCapability.Location.Location.Core 2842 * @since 9 2843 */ 2844 /** 2845 * Enum for location scenario. 2846 * 2847 * @enum { number } 2848 * @syscap SystemCapability.Location.Location.Core 2849 * @atomicservice 2850 * @since 11 2851 */ 2852 export enum LocationRequestScenario { 2853 /** 2854 * Default scenario. 2855 * 2856 * @syscap SystemCapability.Location.Location.Core 2857 * @since 9 2858 */ 2859 /** 2860 * Default scenario. 2861 * 2862 * @syscap SystemCapability.Location.Location.Core 2863 * @atomicservice 2864 * @since 11 2865 */ 2866 UNSET = 0x300, 2867 2868 /** 2869 * Navigation scenario. High positioning precision and real-time performance are required. 2870 * 2871 * @syscap SystemCapability.Location.Location.Core 2872 * @since 9 2873 */ 2874 /** 2875 * Navigation scenario. High positioning precision and real-time performance are required. 2876 * 2877 * @syscap SystemCapability.Location.Location.Core 2878 * @atomicservice 2879 * @since 11 2880 */ 2881 NAVIGATION, 2882 2883 /** 2884 * Trajectory tracking scenario. High positioning precision is required. 2885 * 2886 * @syscap SystemCapability.Location.Location.Core 2887 * @since 9 2888 */ 2889 /** 2890 * Trajectory tracking scenario. High positioning precision is required. 2891 * 2892 * @syscap SystemCapability.Location.Location.Core 2893 * @atomicservice 2894 * @since 11 2895 */ 2896 TRAJECTORY_TRACKING, 2897 2898 /** 2899 * Car hailing scenario. High positioning precision and real-time performance are required. 2900 * 2901 * @syscap SystemCapability.Location.Location.Core 2902 * @since 9 2903 */ 2904 /** 2905 * Car hailing scenario. High positioning precision and real-time performance are required. 2906 * 2907 * @syscap SystemCapability.Location.Location.Core 2908 * @atomicservice 2909 * @since 11 2910 */ 2911 CAR_HAILING, 2912 2913 /** 2914 * Daily life scenarios. Low requirements on positioning precision and real-time performance. 2915 * 2916 * @syscap SystemCapability.Location.Location.Core 2917 * @since 9 2918 */ 2919 /** 2920 * Daily life scenarios. Low requirements on positioning precision and real-time performance. 2921 * 2922 * @syscap SystemCapability.Location.Location.Core 2923 * @atomicservice 2924 * @since 11 2925 */ 2926 DAILY_LIFE_SERVICE, 2927 2928 /** 2929 * Power saving scenarios. 2930 * 2931 * @syscap SystemCapability.Location.Location.Core 2932 * @since 9 2933 */ 2934 /** 2935 * Power saving scenarios. 2936 * 2937 * @syscap SystemCapability.Location.Location.Core 2938 * @atomicservice 2939 * @since 11 2940 */ 2941 NO_POWER 2942 } 2943 2944 /** 2945 * Enum for power consumption scenario. 2946 * 2947 * @enum { number } 2948 * @syscap SystemCapability.Location.Location.Core 2949 * @atomicservice 2950 * @since 12 2951 */ 2952 export enum PowerConsumptionScenario { 2953 /** 2954 * High power consumption mode. 2955 * 2956 * @syscap SystemCapability.Location.Location.Core 2957 * @atomicservice 2958 * @since 12 2959 */ 2960 HIGH_POWER_CONSUMPTION = 0x601, 2961 2962 /** 2963 * Low power consumption mode. 2964 * 2965 * @syscap SystemCapability.Location.Location.Core 2966 * @atomicservice 2967 * @since 12 2968 */ 2969 LOW_POWER_CONSUMPTION = 0x602, 2970 2971 /** 2972 * Power saving scenarios. 2973 * 2974 * @syscap SystemCapability.Location.Location.Core 2975 * @atomicservice 2976 * @since 12 2977 */ 2978 NO_POWER_CONSUMPTION = 0x603 2979 } 2980 2981 /** 2982 * Enum for location privacy type. 2983 * 2984 * @enum { number } 2985 * @syscap SystemCapability.Location.Location.Core 2986 * @systemapi 2987 * @since 9 2988 */ 2989 export enum LocationPrivacyType { 2990 /** 2991 * Other scenarios. 2992 * 2993 * @syscap SystemCapability.Location.Location.Core 2994 * @systemapi 2995 * @since 9 2996 */ 2997 OTHERS = 0, 2998 2999 /** 3000 * Privacy agreement for the startup wizard scenario. 3001 * 3002 * @syscap SystemCapability.Location.Location.Core 3003 * @systemapi 3004 * @since 9 3005 */ 3006 STARTUP, 3007 3008 /** 3009 * Privacy agreement pop-up when network location is enabled. 3010 * 3011 * @syscap SystemCapability.Location.Location.Core 3012 * @systemapi 3013 * @since 9 3014 */ 3015 CORE_LOCATION 3016 } 3017 3018 /** 3019 * Location subsystem command structure. 3020 * 3021 * @typedef LocationCommand 3022 * @syscap SystemCapability.Location.Location.Core 3023 * @since 9 3024 */ 3025 export interface LocationCommand { 3026 /** 3027 * Information about the scenario where the command is sent. 3028 * 3029 * @type { LocationRequestScenario } 3030 * @syscap SystemCapability.Location.Location.Core 3031 * @since 9 3032 */ 3033 scenario: LocationRequestScenario; 3034 3035 /** 3036 * Sent command content. 3037 * 3038 * @type { string } 3039 * @syscap SystemCapability.Location.Location.Core 3040 * @since 9 3041 */ 3042 command: string; 3043 } 3044 3045 /** 3046 * Country code structure. 3047 * 3048 * @typedef CountryCode 3049 * @syscap SystemCapability.Location.Location.Core 3050 * @since 9 3051 */ 3052 export interface CountryCode { 3053 /** 3054 * Country code character string. 3055 * 3056 * @type { string } 3057 * @syscap SystemCapability.Location.Location.Core 3058 * @since 9 3059 */ 3060 country: string; 3061 3062 /** 3063 * Country code source. 3064 * 3065 * @type { CountryCodeType } 3066 * @syscap SystemCapability.Location.Location.Core 3067 * @since 9 3068 */ 3069 type: CountryCodeType; 3070 } 3071 3072 /** 3073 * Enum for country code type. 3074 * 3075 * @enum { number } 3076 * @syscap SystemCapability.Location.Location.Core 3077 * @since 9 3078 */ 3079 export enum CountryCodeType { 3080 /** 3081 * Country code obtained from the locale setting. 3082 * 3083 * @syscap SystemCapability.Location.Location.Core 3084 * @since 9 3085 */ 3086 COUNTRY_CODE_FROM_LOCALE = 1, 3087 3088 /** 3089 * Country code obtained from the SIM information. 3090 * 3091 * @syscap SystemCapability.Location.Location.Core 3092 * @since 9 3093 */ 3094 COUNTRY_CODE_FROM_SIM, 3095 3096 /** 3097 * Query the country code information from the reverse geocoding result. 3098 * 3099 * @syscap SystemCapability.Location.Location.Core 3100 * @since 9 3101 */ 3102 COUNTRY_CODE_FROM_LOCATION, 3103 3104 /** 3105 * Obtain the country code from the cell registration information. 3106 * 3107 * @syscap SystemCapability.Location.Location.Core 3108 * @since 9 3109 */ 3110 COUNTRY_CODE_FROM_NETWORK 3111 } 3112 3113 /** 3114 * Enum for locating required data type. 3115 * 3116 * @enum { number } 3117 * @syscap SystemCapability.Location.Location.Core 3118 * @systemapi 3119 * @since 10 3120 */ 3121 export enum LocatingRequiredDataType { 3122 /** 3123 * Obtains WiFi scanning information for locating. 3124 * 3125 * @syscap SystemCapability.Location.Location.Core 3126 * @systemapi 3127 * @since 10 3128 */ 3129 WIFI = 1, 3130 3131 /** 3132 * Obtains BT scanning information for locating. 3133 * 3134 * @syscap SystemCapability.Location.Location.Core 3135 * @systemapi 3136 * @since 10 3137 */ 3138 BLUETOOTH 3139 } 3140} 3141 3142export default geoLocationManager; 3143