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