鸿蒙开发学习【地图位置服务组件】

简介

移动终端设备已经深入人们日常生活的方方面面,如查看所在城市的天气、新闻轶事、出行打车、旅行导航、运动记录。这些习以为常的活动,都离不开定位用户终端设备的位置。

当用户处于这些丰富的使用场景中时,系统的位置定位能力可以提供实时准确的位置数据。对于开发者,设计基于位置体验的服务,也可以更好的满足用户的需求。

当应用在实现基于设备位置的功能时,如:驾车导航,记录运动轨迹等,可以调用该模块的API接口,完成位置信息的获取

基本概念

位置能力用于确定用户设备在哪里,系统使用位置坐标标示用户设备的位置,并使用多种定位技术提供位置服务,如GNSS定位、基站定位、WLAN/蓝牙定位(基站定位、WLAN/蓝牙定位后续统称“网络定位技术”)。通过这些定位技术,无论用户设备在室内或是户外,都可以准确地确定用户设备的位置。

  • 坐标

    系统以1984年世界大地坐标系统为参考,使用经度、纬度数据描述地球上的一个位置。

  • GNSS定位

    基于全球导航卫星系统,包含:GPS、GLONASS、北斗、Galileo等,通过导航卫星,设备芯片提供的定位算法,来确定设备准确位置。定位过程具体使用哪些定位系统,取决于用户设备的硬件能力。

  • 基站定位

    根据设备当前驻网基站和相邻基站的位置,估算设备当前位置。此定位方式的定位结果精度相对较低,并且需要设备可以访问蜂窝网络。

  • WLAN、蓝牙定位

    根据设备可搜索到的周围WLAN、蓝牙设备位置,估算设备当前位置。此定位方式的定位结果精度依赖设备周围可见的固定WLAN、蓝牙设备的分布,密度较高时,精度也相较与基站定位方式更高,同时也需要设备可以访问网络。

图 1 子系统架构图

更多鸿蒙知识更新在gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md参考前往学习。

OpenHarmony高级技能.png

约束

  • 使用设备的位置能力,需要用户进行确认并主动开启位置开关。如果位置开关没有开启,系统不会向任何应用提供位置服务。
  • 设备位置信息属于用户敏感数据,所以即使用户已经开启位置开关,应用在获取设备位置前仍需向用户申请位置访问权限。在用户确认允许后,系统才会向应用提供位置服务。

说明

接口说明

/** Copyright (c) 2022 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*//*** @file* @kit LocationKit*/import { AsyncCallback, Callback } from './@ohos.base';import { WantAgent } from './@ohos.wantAgent';/*** Provides interfaces for initiating location requests, ending the location service,* and obtaining the location result cached by the system.** @namespace geolocation* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/declare namespace geolocation {/*** Subscribe location changed** @permission ohos.permission.LOCATION* @param { 'locationChange' } type - Indicates the location service event to be subscribed to.* @param { LocationRequest } request - Indicates the location request parameters.* @param { Callback<Location> } callback - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationChange*/function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void;/*** Unsubscribe location changed** @permission ohos.permission.LOCATION* @param { 'locationChange' } type - Indicates the location service event to be subscribed to.* @param { Callback<Location> } [callback] - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationChange*/function off(type: 'locationChange', callback?: Callback<Location>): void;/*** Subscribe location switch changed** @permission ohos.permission.LOCATION* @param { 'locationServiceState' } type - Indicates the location service event to be subscribed to.* @param { Callback<boolean> } callback - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationEnabledChange*/function on(type: 'locationServiceState', callback: Callback<boolean>): void;/*** Unsubscribe location switch changed** @permission ohos.permission.LOCATION* @param { 'locationServiceState' } type - Indicates the location service event to be subscribed to.* @param { Callback<boolean> } [callback] - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationEnabledChange*/function off(type: 'locationServiceState', callback?: Callback<boolean>): void;/*** Subscribe to cache GNSS locations update messages** @permission ohos.permission.LOCATION* @param { 'cachedGnssLocationsReporting' } type - Indicates the location service event to be subscribed to.* @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters.* @param { Callback<Array<Location>> } callback - Indicates the callback for reporting the cached GNSS locations.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.on#event:cachedGnssLocationsChange*/function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void;/*** Unsubscribe to cache GNSS locations update messages** @permission ohos.permission.LOCATION* @param { 'cachedGnssLocationsReporting' } type - Indicates the location service event to be subscribed to.* @param { Callback<Array<Location>> } [callback] - Indicates the callback for reporting the cached gnss locations.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.off#event:cachedGnssLocationsChange*/function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void;/*** Subscribe gnss status changed** @permission ohos.permission.LOCATION* @param { 'gnssStatusChange' } type - Indicates the location service event to be subscribed to.* @param { Callback<SatelliteStatusInfo> } callback - Indicates the callback for reporting the gnss status change.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.on#event:satelliteStatusChange*/function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void;/*** Unsubscribe gnss status changed** @permission ohos.permission.LOCATION* @param { 'gnssStatusChange' } type - Indicates the location service event to be subscribed to.* @param { Callback<SatelliteStatusInfo> } [callback] - Indicates the callback for reporting the gnss status change.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.off#event:satelliteStatusChange*/function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void;/*** Subscribe nmea message changed** @permission ohos.permission.LOCATION* @param { 'nmeaMessageChange' } type - Indicates the location service event to be subscribed to.* @param { Callback<string> } callback - Indicates the callback for reporting the nmea message.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.on#event:nmeaMessage*/function on(type: 'nmeaMessageChange', callback: Callback<string>): void;/*** Unsubscribe nmea message changed** @permission ohos.permission.LOCATION* @param { 'nmeaMessageChange' } type - Indicates the location service event to be subscribed to.* @param { Callback<string> } [callback] - Indicates the callback for reporting the nmea message.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.off#event:nmeaMessage*/function off(type: 'nmeaMessageChange', callback?: Callback<string>): void;/*** Add a geofence and subscribe geo fence status changed** @permission ohos.permission.LOCATION* @param { 'fenceStatusChange' } type - Indicates the location service event to be subscribed to.* @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters.* @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered.* @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.on#event:gnssFenceStatusChange*/function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;/*** Remove a geofence and unsubscribe geo fence status changed** @permission ohos.permission.LOCATION* @param { 'fenceStatusChange' } type - Indicates the location service event to be subscribed to.* @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters.* @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered.* @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.off#event:gnssFenceStatusChange*/function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;/*** Obtain current location** @permission ohos.permission.LOCATION* @param { CurrentLocationRequest } request - Indicates the location request parameters.* @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation*/function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void;/*** Obtain current location** @permission ohos.permission.LOCATION* @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation*/function getCurrentLocation(callback: AsyncCallback<Location>): void;/*** Obtain current location** @permission ohos.permission.LOCATION* @param { CurrentLocationRequest } [request] - Indicates the location request parameters.* @returns { Promise<Location> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation*/function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>;/*** Obtain last known location** @permission ohos.permission.LOCATION* @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation*/function getLastLocation(callback: AsyncCallback<Location>): void;/*** Obtain last known location** @permission ohos.permission.LOCATION* @returns { Promise<Location> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation*/function getLastLocation(): Promise<Location>;/*** Obtain current location switch status** @permission ohos.permission.LOCATION* @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the location switch result.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled*/function isLocationEnabled(callback: AsyncCallback<boolean>): void;/*** Obtain current location switch status** @permission ohos.permission.LOCATION* @returns { Promise<boolean> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled*/function isLocationEnabled(): Promise<boolean>;/*** Request enable location** @permission ohos.permission.LOCATION* @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the location switch status.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/function requestEnableLocation(callback: AsyncCallback<boolean>): void;/*** Request enable location** @permission ohos.permission.LOCATION* @returns { Promise<boolean> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/function requestEnableLocation(): Promise<boolean>;/*** Obtain address info from location** @permission ohos.permission.LOCATION* @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters.* @param { AsyncCallback<Array<GeoAddress>> } callback - Indicates the callback for reporting the address info.* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation*/function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void;/*** Obtain address info from location** @permission ohos.permission.LOCATION* @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters.* @returns { Promise<Array<GeoAddress>> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation*/function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>;/*** Obtain latitude and longitude info from location address** @permission ohos.permission.LOCATION* @param { GeoCodeRequest } request - Indicates the geocode query parameters.* @param { AsyncCallback<Array<GeoAddress>> } callback - Indicates the callback for reporting the latitude and longitude result.* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName*/function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void;/*** Obtain latitude and longitude info from location address** @permission ohos.permission.LOCATION* @param { GeoCodeRequest } request - Indicates the geocode query parameters.* @returns { Promise<Array<GeoAddress>> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName*/function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>;/*** Obtain geocode service status** @permission ohos.permission.LOCATION* @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the geocode service status.* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable*/function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void;/*** Obtain geocode service status** @permission ohos.permission.LOCATION* @returns { Promise<boolean> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable*/function isGeoServiceAvailable(): Promise<boolean>;/*** Obtain the number of cached GNSS locations reported at a time** @permission ohos.permission.LOCATION* @param { AsyncCallback<number> } callback - Indicates the callback for reporting the cached GNSS locations size.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize*/function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void;/*** Obtain the number of cached GNSS locations reported at a time** @permission ohos.permission.LOCATION* @returns { Promise<number> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize*/function getCachedGnssLocationsSize(): Promise<number>;/*** All prepared GNSS locations are returned to the application through the callback function,* and the bottom-layer buffer is cleared.** @permission ohos.permission.LOCATION* @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the result.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations*/function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void;/*** All prepared GNSS locations are returned to the application through the callback function,* and the bottom-layer buffer is cleared.** @permission ohos.permission.LOCATION* @returns { Promise<boolean> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations*/function flushCachedGnssLocations(): Promise<boolean>;/*** Send extended commands to location subsystem.** @permission ohos.permission.LOCATION* @param { LocationCommand } command - Indicates the extended Command Message Body.* @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the send command result.* @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand*/function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void;/*** Send extended commands to location subsystem.** @permission ohos.permission.LOCATION* @param { LocationCommand } command - Indicates the extended Command Message Body.* @returns { Promise<boolean> } The promise returned by the function.* @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand*/function sendCommand(command: LocationCommand): Promise<boolean>;/*** Satellite status information** @interface SatelliteStatusInfo* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.SatelliteStatusInfo*/export interface SatelliteStatusInfo {/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/satellitesNumber: number;/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/satelliteIds: Array<number>;/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/carrierToNoiseDensitys: Array<number>;/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/altitudes: Array<number>;/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/azimuths: Array<number>;/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/carrierFrequencies: Array<number>;}/*** Parameters for requesting to report cache location information** @interface CachedGnssLocationsRequest* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.CachedGnssLocationsRequest*/export interface CachedGnssLocationsRequest {/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/reportingPeriodSec: number;/*** @syscap SystemCapability.Location.Location.Gnss* @since 8* @deprecated since 9*/wakeUpCacheQueueFull: boolean;}/*** Configuring parameters in geo fence requests** @interface GeofenceRequest* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.GeofenceRequest*/export interface GeofenceRequest {/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/priority: LocationRequestPriority;/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/scenario: LocationRequestScenario;/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/geofence: Geofence;}/*** Configuring parameters in geo fence requests** @interface Geofence* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.Geofence*/export interface Geofence {/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/latitude: number;/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/longitude: number;/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/radius: number;/*** @syscap SystemCapability.Location.Location.Geofence* @since 8* @deprecated since 9*/expiration: number;}/*** Configuring parameters in reverse geocode requests** @interface ReverseGeoCodeRequest* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.ReverseGeoCodeRequest*/export interface ReverseGeoCodeRequest {/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/locale?: string;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/latitude: number;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/longitude: number;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/maxItems?: number;}/*** Configuring parameters in geocode requests** @interface GeoCodeRequest* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.GeoCodeRequest*/export interface GeoCodeRequest {/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/locale?: string;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/description: string;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/maxItems?: number;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/minLatitude?: number;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/minLongitude?: number;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/maxLatitude?: number;/*** @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/maxLongitude?: number;}/*** Data struct describes geographic locations.** @interface GeoAddress* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.GeoAddress*/export interface GeoAddress {/*** Indicates latitude information.* A positive value indicates north latitude,* and a negative value indicates south latitude.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/latitude?: number;/*** Indicates longitude information.* A positive value indicates east longitude ,* and a negative value indicates west longitude .** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/longitude?: number;/*** Indicates language used for the location description.* zh indicates Chinese, and en indicates English.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/locale?: string;/*** Indicates landmark of the location.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/placeName?: string;/*** Indicates country code.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/countryCode?: string;/*** Indicates country name.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/countryName?: string;/*** Indicates administrative region name.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/administrativeArea?: string;/*** Indicates sub-administrative region name.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/subAdministrativeArea?: string;/*** Indicates locality information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/locality?: string;/*** Indicates sub-locality information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/subLocality?: string;/*** Indicates road name.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/roadName?: string;/*** Indicates auxiliary road information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/subRoadName?: string;/*** Indicates house information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/premises?: string;/*** Indicates postal code.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/postalCode?: string;/*** Indicates phone number.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/phoneNumber?: string;/*** Indicates website URL.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/addressUrl?: string;/*** Indicates additional information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/descriptions?: Array<string>;/*** Indicates the amount of additional descriptive information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Geocoder* @since 7* @deprecated since 9*/descriptionsSize?: number;}/*** Configuring parameters in location requests** @interface LocationRequest* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequest*/export interface LocationRequest {/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/priority?: LocationRequestPriority;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/scenario?: LocationRequestScenario;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/timeInterval?: number;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/distanceInterval?: number;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/maxAccuracy?: number;}/*** Configuring parameters in current location requests** @interface CurrentLocationRequest* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest*/export interface CurrentLocationRequest {/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/priority?: LocationRequestPriority;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/scenario?: LocationRequestScenario;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/maxAccuracy?: number;/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/timeoutMs?: number;}/*** Provides information about geographic locations** @interface Location* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.Location*/export interface Location {/*** Indicates latitude information.* A positive value indicates north latitude,* and a negative value indicates south latitude.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/latitude: number;/*** Indicates Longitude information.* A positive value indicates east longitude ,* and a negative value indicates west longitude .** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/longitude: number;/*** Indicates location altitude, in meters.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/altitude: number;/*** Indicates location accuracy, in meters.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/accuracy: number;/*** Indicates speed, in m/s.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/speed: number;/*** Indicates location timestamp in the UTC format.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/timeStamp: number;/*** Indicates direction information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/direction: number;/*** Indicates location timestamp since boot.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/timeSinceBoot: number;/*** Indicates additional information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/additions?: Array<string>;/*** Indicates the amount of additional descriptive information.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/additionSize?: number;}/*** Enum for location priority** @permission ohos.permission.LOCATION* @enum { number }* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestPriority*/export enum LocationRequestPriority {/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/UNSET = 0x200,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/ACCURACY,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/LOW_POWER,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/FIRST_FIX}/*** Enum for location scenario** @permission ohos.permission.LOCATION* @enum { number }* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestScenario*/export enum LocationRequestScenario {/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/UNSET = 0x300,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/NAVIGATION,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/TRAJECTORY_TRACKING,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/CAR_HAILING,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/DAILY_LIFE_SERVICE,/*** @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/NO_POWER}/*** Enum for error code** @permission ohos.permission.LOCATION* @enum { number }* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/export enum GeoLocationErrorCode {/*** Indicates input parameter error.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/INPUT_PARAMS_ERROR,/*** Indicates reverse geocode query failed.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/REVERSE_GEOCODE_ERROR,/*** Indicates geocode query failed.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/GEOCODE_ERROR,/*** Indicates positioning failed.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/LOCATOR_ERROR,/*** Indicates operation failure caused by abnormal location switch.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/LOCATION_SWITCH_ERROR,/*** Indicates failed to get the last known location.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/LAST_KNOWN_LOCATION_ERROR,/*** Indicates location request timeout.** @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 7* @deprecated since 9*/LOCATION_REQUEST_TIMEOUT_ERROR}/*** Enum for location privacy type** @permission ohos.permission.LOCATION* @enum { number }* @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.LocationPrivacyType*/export enum LocationPrivacyType {/*** @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9*/OTHERS = 0,/*** @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9*/STARTUP,/*** @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9*/CORE_LOCATION}/*** Location subsystem command structure** @interface LocationCommand* @permission ohos.permission.LOCATION* @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9* @useinstead ohos.geoLocationManager/geoLocationManager.LocationCommand*/export interface LocationCommand {/*** @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9*/scenario: LocationRequestScenario;/*** @syscap SystemCapability.Location.Location.Core* @since 8* @deprecated since 9*/command: string;}}export default geolocation;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/767354.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Python】基础语法(一)

文章目录 1.注释2.关键字与标识符2.1关键字2.2标识符 3.变量4.数据类型4.1数字类型4.2类型转换函数4.3布尔类型 5.输入(input)与输出(print)5.1输入函数(input)5.2输出函数(print) 6.运算符6.1算术运算符6.2比较运算符6.3赋值运算符6.4逻辑运算符6.5运算符优先级 7.字符串7.1字…

JMH微基准测试框架学习笔记

一、简介 JMH&#xff08;Java Microbenchmark Harness&#xff09;是一个用于编写、构建和运行Java微基准测试的框架。它提供了丰富的注解和工具&#xff0c;用于精确控制测试的执行和结果测量&#xff0c;从而帮助我们深入了解代码的性能特性。 二、案例实战 在你的pom文件…

MySQL 排序的那些事儿

书接上回 上次发了几张图&#xff0c;给了几个MySQL Explain的场景&#xff0c;链接在这儿&#xff1a;你是不是MySQL老司机&#xff1f;来看看这些explain结果你能解释吗&#xff1f;MySQL 夺命6连问 我们依次来分析下这6个问题。 在分析之前&#xff0c;我们先来了解一下M…

操作系统面经-用户态和内核态

字节实习生带你面试&#xff0c;后台私信可以获得面试必过大法&#xff01;&#xff01; 根据进程访问资源的特点&#xff0c;我们可以把进程在系统上的运行分为两个级别&#xff1a; 用户态(User Mode) : 用户态运行的进程可以直接读取用户程序的数据&#xff0c;拥有较低的…

【蓝牙协议栈】【BLE】低功耗蓝牙配对绑定过程分析(超详细)

1. 精讲蓝牙协议栈&#xff08;Bluetooth Stack&#xff09;&#xff1a;SPP/A2DP/AVRCP/HFP/PBAP/IAP2/HID/MAP/OPP/PAN/GATTC/GATTS/HOGP等协议理论 2. 欢迎大家关注和订阅&#xff0c;【蓝牙协议栈】和【Android Bluetooth Stack】专栏会持续更新中.....敬请期待&#xff01…

Three.js 中的 OrbitControls 是一个用于控制相机围绕目标旋转以及缩放、平移等操作的控制器。

demo案例 Three.js 中的 OrbitControls 是一个用于控制相机围绕目标旋转以及缩放、平移等操作的控制器。下面是它的详细讲解&#xff1a; 构造函数: OrbitControls(object: Camera, domElement?: HTMLElement)object&#xff1a;THREE.Camera 实例&#xff0c;控制器将围绕…

从零开始学习在VUE3中使用canvas(五):globalCompositeOperation(图形混合)

一、简介 通过设置混合模式来改变图像重叠区域的显示方式。 const ctx canvas.getContext("2d");ctx.globalCompositeOperation "source-over"; 二、属性介绍 source-over 这是默认的复合操作。将源图像绘制到目标图像上&#xff0c;保留目标图像的不透…

IPV6协议之DHCPV6

目录 背景&#xff1a; 一、DHCPV6概述 DHCPv6 Client&#xff1a; DHCPv6 Relay&#xff1a; DHCPv6 Server&#xff1a; 二、DHCPV6工作原理 DHCPV6无状态自动分配 三、DHCP基础配置 服务端 四、DHCPV6地址更新时间&#xff08;DHCPV4租期&#xff09; 五、DHCPV6…

idea 开发serlvet篮球秩序册管理系统idea开发mysql数据库web结构计算机java编程layUI框架开发

一、源码特点 idea开发 java servlet 篮球秩序册管理系统是一套完善的web设计系统mysql数据库 系统采用serlvetdaobean mvc 模式开发&#xff0c;对理解JSP java编程开发语言有帮助&#xff0c;系统具有完整的源代码和数据库&#xff0c;系统主要采用B/S模式开发。 servlet 篮…

☆【前后缀】【双指针】Leetcode 42. 接雨水

【前后缀】【双指针】Leetcode 42. 接雨水 解法1 前后缀分解解法2 双指针 ---------------&#x1f388;&#x1f388;42. 接雨水 题目链接&#x1f388;&#x1f388;------------------- 解法1 前后缀分解 维护一个前缀&#xff08;左侧最高&#xff09;后缀&#xff08;右侧…

【Linux系统编程(进程编程)】进程的退出:父进程等待子进程的退出之僵尸进程与孤儿进程

文章目录 一、进程退出1.1、进程正常退出方式1.2、异常退出 二、父进程等待子进程退出&#xff08;一&#xff09;2.1、为什么要等待子进程退出2.2、&#xff08;1&#xff09;父进程等待子进程退出并收集子进程的退出状态如何等待wstatus空wstatus非空 2.3、&#xff08;2&…

LeetCode---389周赛

题目列表 3083. 字符串及其反转中是否存在同一子字符串 3084. 统计以给定字符开头和结尾的子字符串总数 3085. 成为 K 特殊字符串需要删除的最少字符数 3086. 拾起 K 个 1 需要的最少行动次数 一、字符串及其反转中是否存在同一子字符串 直接暴力枚举即可&#xff0c;代码…

【PHP + 代码审计】数组函数

&#x1f36c; 博主介绍&#x1f468;‍&#x1f393; 博主介绍&#xff1a;大家好&#xff0c;我是 hacker-routing &#xff0c;很高兴认识大家~ ✨主攻领域&#xff1a;【渗透领域】【应急响应】 【Java、PHP】 【VulnHub靶场复现】【面试分析】 &#x1f389;点赞➕评论➕收…

力扣面试150 x 的平方根 二分 换底法 牛顿迭代法 一题多解

Problem: 69. x 的平方根 思路 &#x1f468;‍&#x1f3eb; 参考题解 &#x1f496; 袖珍计算器算法 class Solution {public int mySqrt(int x){if (x 0)return 0; // Math.exp(3)&#xff1a;e的三次方int ans (int) Math.exp(0.5 * Math.log(x));return (long) (an…

配置环境安装包遇到的问题

1. error: could not install packages due to an oserror: [errno 28] no space left on device 说是磁盘占用过多&#xff0c;查看磁盘占用情况。 df -h 果然占比100% 清理了众多缓存.cache都不行&#xff0c;而且其他利用率很低&#xff0c;可能是pip install的过程中使…

qt 实现 轮播图效果,且还有 手动 上一页和下一页 已解决

QT中有 轮播图的需求&#xff0c;按照正常html版本 。只需要配置数组就能搞定&#xff0c;但是c qt版本 应该用什么了。 第一想到的是采用定时器。 // 定时器初始化{m_pTime new QTimer(this);m_pTime->start(4 * 1000);//启动定时器并设置播放时间间隔m_pAutoFlag true;/…

【python】python turtle绘制坤坤打球

一、效果图&#xff1a; 二、准备工作 &#xff08;1)、导入必要的模块&#xff1a; 代码首先导入了需要使用的模块&#xff1a;requests、lxml和csv。 import requests from lxml import etree import csv 如果出现模块报错 进入控制台输入&#xff1a;建议使用国内镜像源 p…

智慧公厕:跨界融合,打造智慧城市新名片

随着城市化进程的不断加快&#xff0c;公共厕所建设成为一个亟待解决的问题。传统的公厕存在着管理繁琐、卫生差、服务不到位等一系列问题&#xff0c;与城市发展的节奏不协调。为此&#xff0c;推进新型智慧公厕建设成为了一个重要的解决方案。智慧公厕的建设需要推进技术融合…

【论文精读】VIT:vision transformer论文

相关文章 【论文精读】Transformer&#xff1a;Attention Is All You Need 文章目录 相关文章一、文章概览&#xff08;一&#xff09;研究背景&#xff08;二&#xff09;核心思路&#xff08;三&#xff09;相关工作&#xff08;三&#xff09;文章结论 二、模型细节&#x…

【MySQL系列】优化数据库时区设置,确保数据一致性与准确性

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…