0.2.49 • Published 2 years ago

@warpsoft/geolocation v0.2.49

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@warpsoft/geolocation

基于百度地图位置服务的定位插件

Install

npm install @warpsoft/geolocation
npx cap sync

iOS

Apple 需要在Info.plist文件中指定获取位置隐私的描述

  • NSLocationAlwaysUsageDescription (Privacy - Location Always Usage Description)
  • NSLocationWhenInUseUsageDescription (Privacy - Location When In Use Usage Description)

百度地图 需要在Info.plist文件中指定 key

  • BMKLocationKey 2LiwwO3SQoYOSoF1lYwAdpc8TkauXpki

Android

百度地图 需要在 AndroidMenifest.xml 中指定 key

  <application>
    ...
+    <meta-data
+      android:name="com.baidu.lbsapi.API_KEY"
+      android:value="2LiwwO3SQoYOSoF1lYwAdpc8TkauXpki" >
+    </meta-data>
    ...
  </application>

API

getCurrentLocation(...)

getCurrentLocation(options: requestOptions) => Promise<Position>

获取当前位置信息

ParamTypeDescription
optionsrequestOptions请求位置信息的选项

Returns: Promise<Position>


watchLocation(...)

watchLocation(options: requestOptions, callback: Function) => Promise<void>

连续获取位置信息

ParamTypeDescription
optionsrequestOptions请求位置信息的选项
callbackFunction处理位置信息的回调函数

watchStatus()

watchStatus() => Promise<Status>

获取监视状态

Returns: Promise<Status>


clearWatch()

clearWatch() => Promise<void>

清除位置监视


Interfaces

Position

当前位置信息

PropTypeDescription
timestring获取时间
coordsCoordinates坐标信息
addrAddress地址信息

Coordinates

地理坐标详细信息

PropTypeDescription
latitudenumber经度
longitudenumber纬度
altitudenumber高度
speednumber速度
directionnumber方向
radiusnumber半径

Address

地址中文详细信息

PropTypeDescription
countrystring国家
adcodestring地区编码
provincestring
citystring
districtstring
streetstring街道
addressstring地址描述
townstring村镇

requestOptions

请求位置信息的选项

PropTypeDescription
withReGeocodeboolean是否携带地址详细信息

Function

Creates a new function.

PropType
prototypeany
lengthnumber
argumentsany
callerFunction
MethodSignatureDescription
apply(this: Function, thisArg: any, argArray?: any) => anyCalls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
call(this: Function, thisArg: any, ...argArray: any[]) => anyCalls a method of an object, substituting another object for the current object.
bind(this: Function, thisArg: any, ...argArray: any[]) => anyFor a given function, creates a bound function that has the same body as the original function. The this object of the bound function is associated with the specified object, and has the specified initial parameters.
toString() => stringReturns a string representation of a function.

Status

位置监视状态

PropTypeDescription
watchingboolean是否正在监视
idstring监视id 可用来 clearWatch 停止监视位置信息
0.2.49

2 years ago

0.2.41

2 years ago

0.2.48

2 years ago

0.2.47

2 years ago

0.2.46

2 years ago

0.2.45

2 years ago

0.2.44

2 years ago

0.2.43

2 years ago

0.2.42

2 years ago

0.1.0

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.8

2 years ago

0.0.9

2 years ago

0.1.7

2 years ago

0.0.8

2 years ago

0.1.9

2 years ago

0.2.3

2 years ago

0.1.4

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.0.7

2 years ago

0.2.4

2 years ago

0.1.5

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago