forked from capacitor-community/background-geolocation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
definitions.d.ts
107 lines (104 loc) · 2.61 KB
/
definitions.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* The add watcher options
*/
export interface WatcherOptions {
/**
* The message to be displayed in the notification bar
*/
backgroundMessage?: string;
/**
* The title of the notification bar
*/
backgroundTitle?: string;
/**
* Whether or not to request permission if there is no permission
*/
requestPermissions?: boolean;
/**
* if "true", stale locations may be delivered while the device obtains a GPS fix.
* You are responsible for checking the "time"
*/
stale?: boolean;
/**
* The minimum number of metres between subsequent locations
*/
distanceFilter?: number;
/**
* A file URL to use to log the locations received, can be good for app crashes and debug
* @example file://path/to/file.txt
*/
file?: string;
}
/**
* The location object
*/
export interface Location {
/**
* Latitude in degrees.
*/
latitude: number;
/**
* Longitude in degrees.
*/
longitude: number;
/**
* Radius of horizontal uncertainty in metres, with 68% confidence.
*/
accuracy: number;
/**
* Metres above sea level (or null).
*/
altitude: number | null;
/**
* Vertical uncertainty in metres, with 68% confidence (or null).
*/
altitudeAccuracy: number | null;
/**
* True if the location was simulated by software, rather than GPS.
*/
simulated: boolean;
/**
* Deviation from true north in degrees (or null).
*/
bearing: number | null;
/**
* Speed in metres per second (or null).
*/
speed: number | null;
/**
* Time the location was produced, in milliseconds since the unix epoch.
*/
time: number | null;
}
export interface CallbackError extends Error {
code?: string;
}
/**
* The plugin's main interface
*/
export interface BackgroundGeolocationPlugin {
/**
* Add a watcher to the GPS according to the given options
* @param options the add watcher options
* @param callback the locaiton callback when a new location is received
* @returns a promise with the watcher ID in order to allow removing it
*/
addWatcher(
options: WatcherOptions,
callback: (
position?: Location,
error?: CallbackError
) => void
): Promise<string>;
/**
* Removes a watcher by ID
* @param options the remove watcher options
*/
removeWatcher(options: {
id: string
}): Promise<void>;
/**
* Opens the OS app settings screen to allow changing permissions
*/
openSettings(): Promise<void>;
}