1.0.0 • Published 4 years ago
capacitor-amap-geolocation v1.0.0
capacitor-amap-geolocation
Amap geolocation for capacitor
Install
npm install capacitor-amap-geolocation
npx cap syncAPI
getCurrentPosition(...)
getCurrentPosition(options?: AmapPositionOptions | undefined) => Promise<AmapPosition>Get the current GPS location of the device
| Param | Type | 
|---|---|
| options | AmapPositionOptions | 
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
| Param | Type | 
|---|---|
| permissions | AmapGeolocationPluginPermissions | 
Returns: Promise<PermissionStatus>
Since: 1.0.0
Interfaces
AmapPosition
| Prop | Type | Description | Since | 
|---|---|---|---|
| timestamp | number | Creation timestamp for coords | 1.0.0 | 
| adCode | string | 地区编码 | 1.0.0 | 
| address | string | 地址 | 1.0.0 | 
| city | string | 城市信息 | 1.0.0 | 
| detail | string | 详细信息 | 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 data | 1.0.0 | 
AmapPositionOptions
| Prop | Type | Description | Default | Since | 
|---|---|---|---|---|
| locationMode | AmapGeolocationPermissionType | High 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_Accuracy | 1.0.0 | 
| timeout | number | The maximum wait time in milliseconds for location updates | 10000 | 1.0.0 | 
PermissionStatus
| Prop | Type | Description | 
|---|---|---|
| High_Accuracy | PermissionState | 高精度定位模式:会同时使用网络定位和GPS定位,优先返回最高精度的定位结果,以及对应的地址描述信息 | 
| Battery_Saving | PermissionState | 低功耗定位模式:不会使用GPS和其他传感器,只会使用网络定位(Wi-Fi和基站定位); | 
| DEVICE_SENSORS | PermissionState | 仅用设备定位模式:不需要连接网络,只使用GPS进行定位,这种模式下不支持室内环境的定位,需要在室外环境下才可以成功定位。 | 
| coarseLocation | PermissionState | 适配web 应用 | 
AmapGeolocationPluginPermissions
| Prop | Type | 
|---|---|
| permissions | AmapGeolocationPermissionType[] | 
Type Aliases
AmapGeolocationPermissionType
'High_Accuracy' | 'Battery_Saving' | 'DEVICE_SENSORS' | 'coarseLocation'
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'