1.0.2 • Published 3 years ago

capacitor-amap-geolocation v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

capacitor-amap-geolocation

Amap geolocation for capacitor

Install

npm install capacitor-amap-geolocation
npx cap sync

API

getCurrentPosition(...)

getCurrentPosition(options?: AmapPositionOptions | undefined) => Promise<AmapPosition>

Get the current GPS location of the device

ParamType
optionsAmapPositionOptions

Returns: Promise<AmapPosition>

Since: 1.0.0


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check location permissions

Returns: Promise<PermissionStatus>

Since: 1.0.0


requestPermissions(...)

requestPermissions(permissions?: AmapGeolocationPluginPermissions | undefined) => Promise<PermissionStatus>

Request location permissions

ParamType
permissionsAmapGeolocationPluginPermissions

Returns: Promise<PermissionStatus>

Since: 1.0.0


Interfaces

AmapPosition

PropTypeDescriptionSince
timestampnumberCreation timestamp for coords1.0.0
adCodestring地区编码1.0.0
addressstring地址1.0.0
citystring城市信息1.0.0
detailstring详细信息1.0.0
coords{ latitude: number; longitude: number; accuracy: number; altitudeAccuracy: number | null; altitude: number | null; speed: number | null; heading: number | null; }The GPS coordinates along with the accuracy of the data1.0.0

AmapPositionOptions

PropTypeDescriptionDefaultSince
locationModeAmapGeolocationPermissionTypeHigh accuracy mode (such as GPS, if available) On Android 12+ devices it will be ignored if users didn't grant ACCESS_FINE_LOCATION permissions (can be checked with location alias).High_Accuracy1.0.0
timeoutnumberThe maximum wait time in milliseconds for location updates100001.0.0

PermissionStatus

PropTypeDescription
High_AccuracyPermissionState高精度定位模式:会同时使用网络定位和GPS定位,优先返回最高精度的定位结果,以及对应的地址描述信息
Battery_SavingPermissionState低功耗定位模式:不会使用GPS和其他传感器,只会使用网络定位(Wi-Fi和基站定位);
DEVICE_SENSORSPermissionState仅用设备定位模式:不需要连接网络,只使用GPS进行定位,这种模式下不支持室内环境的定位,需要在室外环境下才可以成功定位。
coarseLocationPermissionState适配web 应用

AmapGeolocationPluginPermissions

PropType
permissionsAmapGeolocationPermissionType[]

Type Aliases

AmapGeolocationPermissionType

'High_Accuracy' | 'Battery_Saving' | 'DEVICE_SENSORS' | 'coarseLocation'

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'