forked from qiuxiang/react-native-amap-geolocation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
57 lines (50 loc) · 1.42 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { EventSubscription } from "react-native";
export interface Options {
/**
* 是否返回地址信息,默认 false
*/
reGeocode: boolean;
/**
* 是否启用后台定位,默认 false,仅用于 iOS
*/
background: boolean;
/**
* 最小更新距离,默认 0 米,即只要位置更新就立即返回,仅用于 iOS
*
*/
distanceFilter: number;
/**
* 定位请求间隔,默认 2000 毫秒,仅用于 Android
*
*/
interval: number;
}
export interface Location {
accuracy: number; // 定位精度 (m)
latitude: number; // 经度
longitude: number; // 纬度
altitude: number; // 海拔 (m),需要 GPS
speed: number; // 速度 (m/s),需要 GPS
direction: number; // 移动方向,需要 GPS
timestamp: number; // 定位时间
address?: string; // 详细地址
country?: string; // 国家
province?: string; // 省份
city?: string; // 城市
cityCode?: string; // 城市编码
district?: string; // 区
street?: string; // 街道
streetNumber?: string; // 门牌号
poiName?: string; // 兴趣点
}
interface IGeolocation {
init: (params: { ios: string; android: string }) => Promise<void>;
setOptions: (options: Options) => void;
start: () => void;
stop: () => void;
addLocationListener: (
func: (location: Location) => void
) => EventSubscription;
getLastLocation: () => Promise<Location>;
}
export const Geolocation: IGeolocation;