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