@capgo/background-geolocation 7.0.8 → 7.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The options for configuring a watcher that listens for location updates.
2
+ * The options for configuring for location updates.
3
3
  *
4
- * @since 1.0.0
4
+ * @since 7.0.9
5
5
  */
6
- export interface WatcherOptions {
6
+ export interface StartOptions {
7
7
  /**
8
- * If the "backgroundMessage" option is defined, the watcher will
8
+ * If the "backgroundMessage" option is defined, the plugin will
9
9
  * provide location updates whether the app is in the background or the
10
10
  * foreground. If it is not defined, location updates are only
11
11
  * guaranteed in the foreground. This is true on both platforms.
@@ -14,14 +14,14 @@ export interface WatcherOptions {
14
14
  * location updates in the background. This option specifies the text of
15
15
  * that notification.
16
16
  *
17
- * @since 1.0.0
17
+ * @since 7.0.9
18
18
  * @example "Getting your location to provide better service"
19
19
  */
20
20
  backgroundMessage?: string;
21
21
  /**
22
22
  * The title of the notification mentioned above.
23
23
  *
24
- * @since 1.0.0
24
+ * @since 7.0.9
25
25
  * @default "Using your location"
26
26
  * @example "Location Service"
27
27
  */
@@ -30,7 +30,7 @@ export interface WatcherOptions {
30
30
  * Whether permissions should be requested from the user automatically,
31
31
  * if they are not already granted.
32
32
  *
33
- * @since 1.0.0
33
+ * @since 7.0.9
34
34
  * @default true
35
35
  * @example
36
36
  * // Auto-request permissions
@@ -45,7 +45,7 @@ export interface WatcherOptions {
45
45
  * obtains a GPS fix. You are responsible for checking the "time"
46
46
  * property. If "false", locations are guaranteed to be up to date.
47
47
  *
48
- * @since 1.0.0
48
+ * @since 7.0.9
49
49
  * @default false
50
50
  * @example
51
51
  * // Allow stale locations for faster initial response
@@ -59,7 +59,7 @@ export interface WatcherOptions {
59
59
  * The distance in meters that the device must move before a new location update is triggered.
60
60
  * This is used to filter out small movements and reduce the number of updates.
61
61
  *
62
- * @since 1.0.0
62
+ * @since 7.0.9
63
63
  * @default 0
64
64
  * @example
65
65
  * // Update every 10 meters
@@ -74,14 +74,14 @@ export interface WatcherOptions {
74
74
  * Represents a geographical location with various attributes.
75
75
  * Contains all the standard location properties returned by GPS/network providers.
76
76
  *
77
- * @since 1.0.0
77
+ * @since 7.0.0
78
78
  */
79
79
  export interface Location {
80
80
  /**
81
81
  * Latitude in degrees.
82
82
  * Range: -90.0 to +90.0
83
83
  *
84
- * @since 1.0.0
84
+ * @since 7.0.0
85
85
  * @example 40.7128
86
86
  */
87
87
  latitude: number;
@@ -89,7 +89,7 @@ export interface Location {
89
89
  * Longitude in degrees.
90
90
  * Range: -180.0 to +180.0
91
91
  *
92
- * @since 1.0.0
92
+ * @since 7.0.0
93
93
  * @example -74.0060
94
94
  */
95
95
  longitude: number;
@@ -97,21 +97,21 @@ export interface Location {
97
97
  * Radius of horizontal uncertainty in metres, with 68% confidence.
98
98
  * Lower values indicate more accurate location.
99
99
  *
100
- * @since 1.0.0
100
+ * @since 7.0.0
101
101
  * @example 5.0
102
102
  */
103
103
  accuracy: number;
104
104
  /**
105
105
  * Metres above sea level (or null if not available).
106
106
  *
107
- * @since 1.0.0
107
+ * @since 7.0.0
108
108
  * @example 10.5
109
109
  */
110
110
  altitude: number | null;
111
111
  /**
112
112
  * Vertical uncertainty in metres, with 68% confidence (or null if not available).
113
113
  *
114
- * @since 1.0.0
114
+ * @since 7.0.0
115
115
  * @example 3.0
116
116
  */
117
117
  altitudeAccuracy: number | null;
@@ -119,7 +119,7 @@ export interface Location {
119
119
  * `true` if the location was simulated by software, rather than GPS.
120
120
  * Useful for detecting mock locations in development or testing.
121
121
  *
122
- * @since 1.0.0
122
+ * @since 7.0.0
123
123
  * @example false
124
124
  */
125
125
  simulated: boolean;
@@ -127,14 +127,14 @@ export interface Location {
127
127
  * Deviation from true north in degrees (or null if not available).
128
128
  * Range: 0.0 to 360.0
129
129
  *
130
- * @since 1.0.0
130
+ * @since 7.0.0
131
131
  * @example 45.5
132
132
  */
133
133
  bearing: number | null;
134
134
  /**
135
135
  * Speed in metres per second (or null if not available).
136
136
  *
137
- * @since 1.0.0
137
+ * @since 7.0.0
138
138
  * @example 2.5
139
139
  */
140
140
  speed: number | null;
@@ -142,45 +142,55 @@ export interface Location {
142
142
  * Time the location was produced, in milliseconds since the unix epoch.
143
143
  * Use this to check if a location is stale when using stale: true.
144
144
  *
145
- * @since 1.0.0
145
+ * @since 7.0.0
146
146
  * @example 1640995200000
147
147
  */
148
148
  time: number | null;
149
149
  }
150
150
  /**
151
- * Error object that may be passed to the location watcher callback.
151
+ * Error object that may be passed to the location start callback.
152
152
  * Extends the standard Error with optional error codes.
153
153
  *
154
- * @since 1.0.0
154
+ * @since 7.0.0
155
155
  */
156
156
  export interface CallbackError extends Error {
157
157
  /**
158
158
  * Optional error code for more specific error handling.
159
159
  *
160
- * @since 1.0.0
160
+ * @since 7.0.0
161
161
  * @example "PERMISSION_DENIED"
162
162
  */
163
163
  code?: string;
164
164
  }
165
+ export interface PlaySoundOptions {
166
+ /**
167
+ * The name of the sound file to play.
168
+ * Must be a valid sound relative path in the app's public folder to work for both web and native platforms.
169
+ * There's no need to include the public folder in the path.
170
+ * @since 7.0.10
171
+ * @example "notification.mp3"
172
+ * */
173
+ soundFile: string;
174
+ }
165
175
  /**
166
176
  * Main plugin interface for background geolocation functionality.
167
- * Provides methods to manage location watchers and access device settings.
177
+ * Provides methods to manage location updates and access device settings.
168
178
  *
169
- * @since 1.0.0
179
+ * @since 7.0.0
170
180
  */
171
181
  export interface BackgroundGeolocationPlugin {
172
182
  /**
173
- * Adds a watcher for location updates.
174
- * The watcher will be invoked with the latest location whenever it is available.
175
- * If an error occurs, the callback will be invoked with the error.
183
+ * To start listening for changes in the device's location, call this method.
184
+ * A Promise is returned to indicate that it finished the call. The callback will be called every time a new location
185
+ * is available, or if there was an error when calling this method. Don't rely on promise rejection for this.
176
186
  *
177
- * @param options The watcher configuration options
187
+ * @param options The configuration options
178
188
  * @param callback The callback function invoked when a new location is available or an error occurs
179
- * @returns A promise that resolves to a unique identifier for the watcher ID
189
+ * @returns A promise that resolves when the method is successfully called
180
190
  *
181
- * @since 1.0.0
191
+ * @since 7.0.9
182
192
  * @example
183
- * const watcherId = await BackgroundGeolocation.addWatcher(
193
+ * await BackgroundGeolocation.start(
184
194
  * {
185
195
  * backgroundMessage: "App is using your location in the background",
186
196
  * backgroundTitle: "Location Service",
@@ -199,31 +209,44 @@ export interface BackgroundGeolocationPlugin {
199
209
  * }
200
210
  * );
201
211
  */
202
- addWatcher(options: WatcherOptions, callback: (position?: Location, error?: CallbackError) => void): Promise<string>;
212
+ start(options: StartOptions, callback: (position?: Location, error?: CallbackError) => void): Promise<void>;
203
213
  /**
204
- * Removes a watcher by its unique identifier.
205
- * Stops location updates for the specified watcher.
214
+ * Stops location updates.
206
215
  *
207
- * @param options Object containing the watcher ID to remove
208
- * @returns A promise that resolves when the watcher is successfully removed
216
+ * @returns A promise that resolves when the plugin stops successfully removed
209
217
  *
210
- * @since 1.0.0
218
+ * @since 7.0.9
211
219
  * @example
212
- * await BackgroundGeolocation.removeWatcher({ id: watcherId });
220
+ * await BackgroundGeolocation.stop();
213
221
  */
214
- removeWatcher(options: {
215
- id: string;
216
- }): Promise<void>;
222
+ stop(): Promise<void>;
217
223
  /**
218
224
  * Opens the device's location settings page.
219
225
  * Useful for directing users to enable location services or adjust permissions.
220
226
  *
221
227
  * @returns A promise that resolves when the settings page is opened
222
228
  *
223
- * @since 1.0.0
229
+ * @since 7.0.0
224
230
  * @example
225
231
  * // Direct user to location settings
226
232
  * await BackgroundGeolocation.openSettings();
227
233
  */
228
234
  openSettings(): Promise<void>;
235
+ /**
236
+ * Plays a sound file.
237
+ * This should be used to play a sound, in the background too.
238
+ * The idea behind this is to allow the user to hear a sound when a new location is available or when going off track.
239
+ * If you simply need to play a sound, you can use `@capgo/native-audio` plugin instead.
240
+ * For Android, there's a need to start monitoring location updates first, otherwise the sound will not play.
241
+ *
242
+ * @param options The options for playing the sound
243
+ * @returns A promise that resolves when the sound is successfully played
244
+ *
245
+ * @since 7.0.10
246
+ * @example
247
+ * await BackgroundGeolocation.playSound({
248
+ * soundFile: "notification.mp3"
249
+ * });
250
+ */
251
+ playSound(options: PlaySoundOptions): Promise<void>;
229
252
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The options for configuring a watcher that listens for location updates.\n *\n * @since 1.0.0\n */\nexport interface WatcherOptions {\n /**\n * If the \"backgroundMessage\" option is defined, the watcher will\n * provide location updates whether the app is in the background or the\n * foreground. If it is not defined, location updates are only\n * guaranteed in the foreground. This is true on both platforms.\n *\n * On Android, a notification must be shown to continue receiving\n * location updates in the background. This option specifies the text of\n * that notification.\n *\n * @since 1.0.0\n * @example \"Getting your location to provide better service\"\n */\n backgroundMessage?: string;\n /**\n * The title of the notification mentioned above.\n *\n * @since 1.0.0\n * @default \"Using your location\"\n * @example \"Location Service\"\n */\n backgroundTitle?: string;\n /**\n * Whether permissions should be requested from the user automatically,\n * if they are not already granted.\n *\n * @since 1.0.0\n * @default true\n * @example\n * // Auto-request permissions\n * requestPermissions: true\n *\n * // Don't auto-request, handle manually\n * requestPermissions: false\n */\n requestPermissions?: boolean;\n /**\n * If \"true\", stale locations may be delivered while the device\n * obtains a GPS fix. You are responsible for checking the \"time\"\n * property. If \"false\", locations are guaranteed to be up to date.\n *\n * @since 1.0.0\n * @default false\n * @example\n * // Allow stale locations for faster initial response\n * stale: true\n *\n * // Only fresh locations\n * stale: false\n */\n stale?: boolean;\n /**\n * The distance in meters that the device must move before a new location update is triggered.\n * This is used to filter out small movements and reduce the number of updates.\n *\n * @since 1.0.0\n * @default 0\n * @example\n * // Update every 10 meters\n * distanceFilter: 10\n *\n * // Update on any movement\n * distanceFilter: 0\n */\n distanceFilter?: number;\n}\n\n/**\n * Represents a geographical location with various attributes.\n * Contains all the standard location properties returned by GPS/network providers.\n *\n * @since 1.0.0\n */\nexport interface Location {\n /**\n * Latitude in degrees.\n * Range: -90.0 to +90.0\n *\n * @since 1.0.0\n * @example 40.7128\n */\n latitude: number;\n /**\n * Longitude in degrees.\n * Range: -180.0 to +180.0\n *\n * @since 1.0.0\n * @example -74.0060\n */\n longitude: number;\n /**\n * Radius of horizontal uncertainty in metres, with 68% confidence.\n * Lower values indicate more accurate location.\n *\n * @since 1.0.0\n * @example 5.0\n */\n accuracy: number;\n /**\n * Metres above sea level (or null if not available).\n *\n * @since 1.0.0\n * @example 10.5\n */\n altitude: number | null;\n /**\n * Vertical uncertainty in metres, with 68% confidence (or null if not available).\n *\n * @since 1.0.0\n * @example 3.0\n */\n altitudeAccuracy: number | null;\n /**\n * `true` if the location was simulated by software, rather than GPS.\n * Useful for detecting mock locations in development or testing.\n *\n * @since 1.0.0\n * @example false\n */\n simulated: boolean;\n /**\n * Deviation from true north in degrees (or null if not available).\n * Range: 0.0 to 360.0\n *\n * @since 1.0.0\n * @example 45.5\n */\n bearing: number | null;\n /**\n * Speed in metres per second (or null if not available).\n *\n * @since 1.0.0\n * @example 2.5\n */\n speed: number | null;\n /**\n * Time the location was produced, in milliseconds since the unix epoch.\n * Use this to check if a location is stale when using stale: true.\n *\n * @since 1.0.0\n * @example 1640995200000\n */\n time: number | null;\n}\n\n/**\n * Error object that may be passed to the location watcher callback.\n * Extends the standard Error with optional error codes.\n *\n * @since 1.0.0\n */\nexport interface CallbackError extends Error {\n /**\n * Optional error code for more specific error handling.\n *\n * @since 1.0.0\n * @example \"PERMISSION_DENIED\"\n */\n code?: string;\n}\n\n/**\n * Main plugin interface for background geolocation functionality.\n * Provides methods to manage location watchers and access device settings.\n *\n * @since 1.0.0\n */\nexport interface BackgroundGeolocationPlugin {\n /**\n * Adds a watcher for location updates.\n * The watcher will be invoked with the latest location whenever it is available.\n * If an error occurs, the callback will be invoked with the error.\n *\n * @param options The watcher configuration options\n * @param callback The callback function invoked when a new location is available or an error occurs\n * @returns A promise that resolves to a unique identifier for the watcher ID\n *\n * @since 1.0.0\n * @example\n * const watcherId = await BackgroundGeolocation.addWatcher(\n * {\n * backgroundMessage: \"App is using your location in the background\",\n * backgroundTitle: \"Location Service\",\n * requestPermissions: true,\n * stale: false,\n * distanceFilter: 10\n * },\n * (location, error) => {\n * if (error) {\n * console.error('Location error:', error);\n * return;\n * }\n * if (location) {\n * console.log('New location:', location.latitude, location.longitude);\n * }\n * }\n * );\n */\n addWatcher(\n options: WatcherOptions,\n callback: (position?: Location, error?: CallbackError) => void,\n ): Promise<string>;\n\n /**\n * Removes a watcher by its unique identifier.\n * Stops location updates for the specified watcher.\n *\n * @param options Object containing the watcher ID to remove\n * @returns A promise that resolves when the watcher is successfully removed\n *\n * @since 1.0.0\n * @example\n * await BackgroundGeolocation.removeWatcher({ id: watcherId });\n */\n removeWatcher(options: { id: string }): Promise<void>;\n\n /**\n * Opens the device's location settings page.\n * Useful for directing users to enable location services or adjust permissions.\n *\n * @returns A promise that resolves when the settings page is opened\n *\n * @since 1.0.0\n * @example\n * // Direct user to location settings\n * await BackgroundGeolocation.openSettings();\n */\n openSettings(): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The options for configuring for location updates.\n *\n * @since 7.0.9\n */\nexport interface StartOptions {\n /**\n * If the \"backgroundMessage\" option is defined, the plugin will\n * provide location updates whether the app is in the background or the\n * foreground. If it is not defined, location updates are only\n * guaranteed in the foreground. This is true on both platforms.\n *\n * On Android, a notification must be shown to continue receiving\n * location updates in the background. This option specifies the text of\n * that notification.\n *\n * @since 7.0.9\n * @example \"Getting your location to provide better service\"\n */\n backgroundMessage?: string;\n /**\n * The title of the notification mentioned above.\n *\n * @since 7.0.9\n * @default \"Using your location\"\n * @example \"Location Service\"\n */\n backgroundTitle?: string;\n /**\n * Whether permissions should be requested from the user automatically,\n * if they are not already granted.\n *\n * @since 7.0.9\n * @default true\n * @example\n * // Auto-request permissions\n * requestPermissions: true\n *\n * // Don't auto-request, handle manually\n * requestPermissions: false\n */\n requestPermissions?: boolean;\n /**\n * If \"true\", stale locations may be delivered while the device\n * obtains a GPS fix. You are responsible for checking the \"time\"\n * property. If \"false\", locations are guaranteed to be up to date.\n *\n * @since 7.0.9\n * @default false\n * @example\n * // Allow stale locations for faster initial response\n * stale: true\n *\n * // Only fresh locations\n * stale: false\n */\n stale?: boolean;\n /**\n * The distance in meters that the device must move before a new location update is triggered.\n * This is used to filter out small movements and reduce the number of updates.\n *\n * @since 7.0.9\n * @default 0\n * @example\n * // Update every 10 meters\n * distanceFilter: 10\n *\n * // Update on any movement\n * distanceFilter: 0\n */\n distanceFilter?: number;\n}\n\n/**\n * Represents a geographical location with various attributes.\n * Contains all the standard location properties returned by GPS/network providers.\n *\n * @since 7.0.0\n */\nexport interface Location {\n /**\n * Latitude in degrees.\n * Range: -90.0 to +90.0\n *\n * @since 7.0.0\n * @example 40.7128\n */\n latitude: number;\n /**\n * Longitude in degrees.\n * Range: -180.0 to +180.0\n *\n * @since 7.0.0\n * @example -74.0060\n */\n longitude: number;\n /**\n * Radius of horizontal uncertainty in metres, with 68% confidence.\n * Lower values indicate more accurate location.\n *\n * @since 7.0.0\n * @example 5.0\n */\n accuracy: number;\n /**\n * Metres above sea level (or null if not available).\n *\n * @since 7.0.0\n * @example 10.5\n */\n altitude: number | null;\n /**\n * Vertical uncertainty in metres, with 68% confidence (or null if not available).\n *\n * @since 7.0.0\n * @example 3.0\n */\n altitudeAccuracy: number | null;\n /**\n * `true` if the location was simulated by software, rather than GPS.\n * Useful for detecting mock locations in development or testing.\n *\n * @since 7.0.0\n * @example false\n */\n simulated: boolean;\n /**\n * Deviation from true north in degrees (or null if not available).\n * Range: 0.0 to 360.0\n *\n * @since 7.0.0\n * @example 45.5\n */\n bearing: number | null;\n /**\n * Speed in metres per second (or null if not available).\n *\n * @since 7.0.0\n * @example 2.5\n */\n speed: number | null;\n /**\n * Time the location was produced, in milliseconds since the unix epoch.\n * Use this to check if a location is stale when using stale: true.\n *\n * @since 7.0.0\n * @example 1640995200000\n */\n time: number | null;\n}\n\n/**\n * Error object that may be passed to the location start callback.\n * Extends the standard Error with optional error codes.\n *\n * @since 7.0.0\n */\nexport interface CallbackError extends Error {\n /**\n * Optional error code for more specific error handling.\n *\n * @since 7.0.0\n * @example \"PERMISSION_DENIED\"\n */\n code?: string;\n}\n\nexport interface PlaySoundOptions {\n /**\n * The name of the sound file to play.\n * Must be a valid sound relative path in the app's public folder to work for both web and native platforms.\n * There's no need to include the public folder in the path.\n * @since 7.0.10\n * @example \"notification.mp3\"\n * */\n soundFile: string;\n}\n\n/**\n * Main plugin interface for background geolocation functionality.\n * Provides methods to manage location updates and access device settings.\n *\n * @since 7.0.0\n */\nexport interface BackgroundGeolocationPlugin {\n /**\n * To start listening for changes in the device's location, call this method.\n * A Promise is returned to indicate that it finished the call. The callback will be called every time a new location\n * is available, or if there was an error when calling this method. Don't rely on promise rejection for this.\n *\n * @param options The configuration options\n * @param callback The callback function invoked when a new location is available or an error occurs\n * @returns A promise that resolves when the method is successfully called\n *\n * @since 7.0.9\n * @example\n * await BackgroundGeolocation.start(\n * {\n * backgroundMessage: \"App is using your location in the background\",\n * backgroundTitle: \"Location Service\",\n * requestPermissions: true,\n * stale: false,\n * distanceFilter: 10\n * },\n * (location, error) => {\n * if (error) {\n * console.error('Location error:', error);\n * return;\n * }\n * if (location) {\n * console.log('New location:', location.latitude, location.longitude);\n * }\n * }\n * );\n */\n start(\n options: StartOptions,\n callback: (position?: Location, error?: CallbackError) => void,\n ): Promise<void>;\n\n /**\n * Stops location updates.\n *\n * @returns A promise that resolves when the plugin stops successfully removed\n *\n * @since 7.0.9\n * @example\n * await BackgroundGeolocation.stop();\n */\n stop(): Promise<void>;\n\n /**\n * Opens the device's location settings page.\n * Useful for directing users to enable location services or adjust permissions.\n *\n * @returns A promise that resolves when the settings page is opened\n *\n * @since 7.0.0\n * @example\n * // Direct user to location settings\n * await BackgroundGeolocation.openSettings();\n */\n openSettings(): Promise<void>;\n\n /**\n * Plays a sound file.\n * This should be used to play a sound, in the background too.\n * The idea behind this is to allow the user to hear a sound when a new location is available or when going off track.\n * If you simply need to play a sound, you can use `@capgo/native-audio` plugin instead.\n * For Android, there's a need to start monitoring location updates first, otherwise the sound will not play.\n *\n * @param options The options for playing the sound\n * @returns A promise that resolves when the sound is successfully played\n *\n * @since 7.0.10\n * @example\n * await BackgroundGeolocation.playSound({\n * soundFile: \"notification.mp3\"\n * });\n */\n playSound(options: PlaySoundOptions): Promise<void>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
- import type { BackgroundGeolocationPlugin, WatcherOptions, Location, CallbackError } from "./definitions";
2
+ import type { BackgroundGeolocationPlugin, StartOptions, Location, CallbackError, PlaySoundOptions } from "./definitions";
3
3
  export declare class BackgroundGeolocationWeb extends WebPlugin implements BackgroundGeolocationPlugin {
4
- private watchers;
5
- private watcherCounter;
6
- addWatcher(options: WatcherOptions, callback: (position?: Location, error?: CallbackError) => void): Promise<string>;
7
- removeWatcher(options: {
8
- id: string;
9
- }): Promise<void>;
4
+ private watchId;
5
+ start(options: StartOptions, callback: (position?: Location, error?: CallbackError) => void): Promise<void>;
6
+ stop(): Promise<void>;
10
7
  openSettings(): Promise<void>;
8
+ playSound(options: PlaySoundOptions): Promise<void>;
11
9
  }
package/dist/esm/web.js CHANGED
@@ -1,21 +1,23 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
2
  export class BackgroundGeolocationWeb extends WebPlugin {
3
- constructor() {
4
- super(...arguments);
5
- this.watchers = new Map();
6
- this.watcherCounter = 0;
7
- }
8
- async addWatcher(options, callback) {
9
- const watcherId = `watcher_${++this.watcherCounter}`;
3
+ async start(options, callback) {
10
4
  if (!navigator.geolocation) {
11
5
  callback(undefined, {
12
6
  name: "GeolocationError",
13
7
  message: "Geolocation is not supported by this browser",
14
8
  code: "NOT_SUPPORTED",
15
9
  });
16
- return watcherId;
10
+ return;
11
+ }
12
+ if (this.watchId) {
13
+ callback(undefined, {
14
+ name: "GeolocationError",
15
+ message: "Geolocation already started",
16
+ code: "ALREADY_STARTED",
17
+ });
18
+ return;
17
19
  }
18
- const watchId = navigator.geolocation.watchPosition((position) => {
20
+ this.watchId = navigator.geolocation.watchPosition((position) => {
19
21
  const location = {
20
22
  latitude: position.coords.latitude,
21
23
  longitude: position.coords.longitude,
@@ -40,19 +42,28 @@ export class BackgroundGeolocationWeb extends WebPlugin {
40
42
  timeout: 10000,
41
43
  maximumAge: options.stale ? 300000 : 0,
42
44
  });
43
- this.watchers.set(watcherId, { watchId, callback });
44
- return watcherId;
45
45
  }
46
- async removeWatcher(options) {
47
- const watcher = this.watchers.get(options.id);
48
- if (watcher) {
49
- navigator.geolocation.clearWatch(watcher.watchId);
50
- this.watchers.delete(options.id);
46
+ async stop() {
47
+ if (this.watchId) {
48
+ navigator.geolocation.clearWatch(this.watchId);
49
+ delete this.watchId;
51
50
  }
52
51
  }
53
52
  async openSettings() {
54
53
  console.log("openSettings: Web implementation cannot open native settings");
55
54
  window.alert("Please enable location permissions in your browser settings");
56
55
  }
56
+ async playSound(options) {
57
+ if (!options.soundFile) {
58
+ throw new Error("Sound file is required");
59
+ }
60
+ const audio = new Audio(options.soundFile);
61
+ try {
62
+ await audio.play();
63
+ }
64
+ catch (error) {
65
+ throw new Error(`Failed to play sound: ${error.message}`);
66
+ }
67
+ }
57
68
  }
58
69
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,wBACX,SAAQ,SAAS;IADnB;;QAIU,aAAQ,GAAG,IAAI,GAAG,EAMvB,CAAC;QACI,mBAAc,GAAG,CAAC,CAAC;IA+D7B,CAAC;IA7DC,KAAK,CAAC,UAAU,CACd,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,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACvC,CACF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,OAAO,EAAE,CAAC;YACZ,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;QAC5E,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC9E,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n BackgroundGeolocationPlugin,\n WatcherOptions,\n Location,\n CallbackError,\n} from \"./definitions\";\n\nexport class BackgroundGeolocationWeb\n extends WebPlugin\n implements BackgroundGeolocationPlugin\n{\n private watchers = new Map<\n string,\n {\n watchId: number;\n callback: (position?: Location, error?: CallbackError) => void;\n }\n >();\n private watcherCounter = 0;\n\n async addWatcher(\n options: WatcherOptions,\n callback: (position?: Location, error?: CallbackError) => void,\n ): Promise<string> {\n const watcherId = `watcher_${++this.watcherCounter}`;\n\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return watcherId;\n }\n\n const watchId = navigator.geolocation.watchPosition(\n (position) => {\n const location: Location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n },\n (error) => {\n const callbackError: CallbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n },\n {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n },\n );\n\n this.watchers.set(watcherId, { watchId, callback });\n return watcherId;\n }\n\n async removeWatcher(options: { id: string }): Promise<void> {\n const watcher = this.watchers.get(options.id);\n if (watcher) {\n navigator.geolocation.clearWatch(watcher.watchId);\n this.watchers.delete(options.id);\n }\n }\n\n async openSettings(): Promise<void> {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,wBACX,SAAQ,SAAS;IAKjB,KAAK,CAAC,KAAK,CACT,OAAqB,EACrB,QAA8D;QAE9D,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YAC3B,QAAQ,CAAC,SAAS,EAAE;gBAClB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,8CAA8C;gBACvD,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,QAAQ,CAAC,SAAS,EAAE;gBAClB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,6BAA6B;gBACtC,IAAI,EAAE,iBAAiB;aACxB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,aAAa,CAChD,CAAC,Q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AAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAyB;QACvC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,yBAA0B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n BackgroundGeolocationPlugin,\n StartOptions,\n Location,\n CallbackError,\n PlaySoundOptions,\n} from \"./definitions\";\n\nexport class BackgroundGeolocationWeb\n extends WebPlugin\n implements BackgroundGeolocationPlugin\n{\n private watchId: number | undefined;\n\n async start(\n options: StartOptions,\n callback: (position?: Location, error?: CallbackError) => void,\n ): Promise<void> {\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return;\n }\n\n if (this.watchId) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation already started\",\n code: \"ALREADY_STARTED\",\n });\n return;\n }\n\n this.watchId = navigator.geolocation.watchPosition(\n (position) => {\n const location: Location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n },\n (error) => {\n const callbackError: CallbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n },\n {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n },\n );\n }\n\n async stop(): Promise<void> {\n if (this.watchId) {\n navigator.geolocation.clearWatch(this.watchId);\n delete this.watchId;\n }\n }\n\n async openSettings(): Promise<void> {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n\n async playSound(options: PlaySoundOptions): Promise<void> {\n if (!options.soundFile) {\n throw new Error(\"Sound file is required\");\n }\n const audio = new Audio(options.soundFile);\n try {\n await audio.play();\n } catch (error) {\n throw new Error(`Failed to play sound: ${(error as Error).message}`);\n }\n }\n}\n"]}
@@ -7,22 +7,24 @@ const BackgroundGeolocation = core.registerPlugin("BackgroundGeolocation", {
7
7
  });
8
8
 
9
9
  class BackgroundGeolocationWeb extends core.WebPlugin {
10
- constructor() {
11
- super(...arguments);
12
- this.watchers = new Map();
13
- this.watcherCounter = 0;
14
- }
15
- async addWatcher(options, callback) {
16
- const watcherId = `watcher_${++this.watcherCounter}`;
10
+ async start(options, callback) {
17
11
  if (!navigator.geolocation) {
18
12
  callback(undefined, {
19
13
  name: "GeolocationError",
20
14
  message: "Geolocation is not supported by this browser",
21
15
  code: "NOT_SUPPORTED",
22
16
  });
23
- return watcherId;
17
+ return;
18
+ }
19
+ if (this.watchId) {
20
+ callback(undefined, {
21
+ name: "GeolocationError",
22
+ message: "Geolocation already started",
23
+ code: "ALREADY_STARTED",
24
+ });
25
+ return;
24
26
  }
25
- const watchId = navigator.geolocation.watchPosition((position) => {
27
+ this.watchId = navigator.geolocation.watchPosition((position) => {
26
28
  const location = {
27
29
  latitude: position.coords.latitude,
28
30
  longitude: position.coords.longitude,
@@ -47,20 +49,29 @@ class BackgroundGeolocationWeb extends core.WebPlugin {
47
49
  timeout: 10000,
48
50
  maximumAge: options.stale ? 300000 : 0,
49
51
  });
50
- this.watchers.set(watcherId, { watchId, callback });
51
- return watcherId;
52
52
  }
53
- async removeWatcher(options) {
54
- const watcher = this.watchers.get(options.id);
55
- if (watcher) {
56
- navigator.geolocation.clearWatch(watcher.watchId);
57
- this.watchers.delete(options.id);
53
+ async stop() {
54
+ if (this.watchId) {
55
+ navigator.geolocation.clearWatch(this.watchId);
56
+ delete this.watchId;
58
57
  }
59
58
  }
60
59
  async openSettings() {
61
60
  console.log("openSettings: Web implementation cannot open native settings");
62
61
  window.alert("Please enable location permissions in your browser settings");
63
62
  }
63
+ async playSound(options) {
64
+ if (!options.soundFile) {
65
+ throw new Error("Sound file is required");
66
+ }
67
+ const audio = new Audio(options.soundFile);
68
+ try {
69
+ await audio.play();
70
+ }
71
+ catch (error) {
72
+ throw new Error(`Failed to play sound: ${error.message}`);
73
+ }
74
+ }
64
75
  }
65
76
 
66
77
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst BackgroundGeolocation = registerPlugin(\"BackgroundGeolocation\", {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n});\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class BackgroundGeolocationWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.watchers = new Map();\n this.watcherCounter = 0;\n }\n async addWatcher(options, callback) {\n const watcherId = `watcher_${++this.watcherCounter}`;\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return watcherId;\n }\n const watchId = navigator.geolocation.watchPosition((position) => {\n const location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n }, (error) => {\n const callbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n }, {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n });\n this.watchers.set(watcherId, { watchId, callback });\n return watcherId;\n }\n async removeWatcher(options) {\n const watcher = this.watchers.get(options.id);\n if (watcher) {\n navigator.geolocation.clearWatch(watcher.watchId);\n this.watchers.delete(options.id);\n }\n }\n async openSettings() {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC5E,CAAC;;ACFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE;AACjC,QAAQ,IAAI,CAAC,cAAc,GAAG,CAAC;AAC/B,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE;AACxC,QAAQ,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAC5D,QAAQ,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;AACpC,YAAY,QAAQ,CAAC,SAAS,EAAE;AAChC,gBAAgB,IAAI,EAAE,kBAAkB;AACxC,gBAAgB,OAAO,EAAE,8CAA8C;AACvE,gBAAgB,IAAI,EAAE,eAAe;AACrC,aAAa,CAAC;AACd,YAAY,OAAO,SAAS;A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3D,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;AACjC,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;AACrD,QAAQ,IAAI,OAAO,EAAE;AACrB,YAAY,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;AAC7D,YAAY,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAC5C,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF,QAAQ,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC;AACnF,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst BackgroundGeolocation = registerPlugin(\"BackgroundGeolocation\", {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n});\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class BackgroundGeolocationWeb extends WebPlugin {\n async start(options, callback) {\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return;\n }\n if (this.watchId) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation already started\",\n code: \"ALREADY_STARTED\",\n });\n return;\n }\n this.watchId = navigator.geolocation.watchPosition((position) => {\n const location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n }, (error) => {\n const callbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n }, {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n });\n }\n async stop() {\n if (this.watchId) {\n navigator.geolocation.clearWatch(this.watchId);\n delete this.watchId;\n }\n }\n async openSettings() {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n async playSound(options) {\n if (!options.soundFile) {\n throw new Error(\"Sound file is required\");\n }\n const audio = new Audio(options.soundFile);\n try {\n await audio.play();\n }\n catch (error) {\n throw new Error(`Failed to play sound: ${error.message}`);\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC5E,CAAC;;ACFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE;AACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;AACpC,YAAY,QAAQ,CAAC,SAAS,EAAE;AAChC,gBAAgB,IAAI,EAAE,kBAAkB;AACxC,gBAAgB,OAAO,EAAE,8CAA8C;AACvE,gBAAgB,IAAI,EAAE,eAAe;AACrC,aAAa,CAAC;AACd,YAAY;AACZ,QAAQ;AACR,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;AAC1B,YAAY,QAAQ,CAAC,SAAS,EAAE;AAChC,gBAAgB,IAAI,EAAE,kBAAkB;AACxC,gBAAgB,OAAO,EAAE,6BAA6B;AACtD,gBAAgB,IAAI,EAAE,iBAAiB;AACvC,aAAa,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AE;AAC1B,YAAY,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;AAC1D,YAAY,OAAO,IAAI,CAAC,OAAO;AAC/B,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF,QAAQ,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC;AACnF,IAAI;AACJ,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;AAChC,YAAY,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC;AACrD,QAAQ;AACR,QAAQ,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAClD,QAAQ,IAAI;AACZ,YAAY,MAAM,KAAK,CAAC,IAAI,EAAE;AAC9B,QAAQ;AACR,QAAQ,OAAO,KAAK,EAAE;AACtB,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,sBAAsB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACrE,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -6,22 +6,24 @@ var capacitorBackgroundGeolocation = (function (exports, core) {
6
6
  });
7
7
 
8
8
  class BackgroundGeolocationWeb extends core.WebPlugin {
9
- constructor() {
10
- super(...arguments);
11
- this.watchers = new Map();
12
- this.watcherCounter = 0;
13
- }
14
- async addWatcher(options, callback) {
15
- const watcherId = `watcher_${++this.watcherCounter}`;
9
+ async start(options, callback) {
16
10
  if (!navigator.geolocation) {
17
11
  callback(undefined, {
18
12
  name: "GeolocationError",
19
13
  message: "Geolocation is not supported by this browser",
20
14
  code: "NOT_SUPPORTED",
21
15
  });
22
- return watcherId;
16
+ return;
17
+ }
18
+ if (this.watchId) {
19
+ callback(undefined, {
20
+ name: "GeolocationError",
21
+ message: "Geolocation already started",
22
+ code: "ALREADY_STARTED",
23
+ });
24
+ return;
23
25
  }
24
- const watchId = navigator.geolocation.watchPosition((position) => {
26
+ this.watchId = navigator.geolocation.watchPosition((position) => {
25
27
  const location = {
26
28
  latitude: position.coords.latitude,
27
29
  longitude: position.coords.longitude,
@@ -46,20 +48,29 @@ var capacitorBackgroundGeolocation = (function (exports, core) {
46
48
  timeout: 10000,
47
49
  maximumAge: options.stale ? 300000 : 0,
48
50
  });
49
- this.watchers.set(watcherId, { watchId, callback });
50
- return watcherId;
51
51
  }
52
- async removeWatcher(options) {
53
- const watcher = this.watchers.get(options.id);
54
- if (watcher) {
55
- navigator.geolocation.clearWatch(watcher.watchId);
56
- this.watchers.delete(options.id);
52
+ async stop() {
53
+ if (this.watchId) {
54
+ navigator.geolocation.clearWatch(this.watchId);
55
+ delete this.watchId;
57
56
  }
58
57
  }
59
58
  async openSettings() {
60
59
  console.log("openSettings: Web implementation cannot open native settings");
61
60
  window.alert("Please enable location permissions in your browser settings");
62
61
  }
62
+ async playSound(options) {
63
+ if (!options.soundFile) {
64
+ throw new Error("Sound file is required");
65
+ }
66
+ const audio = new Audio(options.soundFile);
67
+ try {
68
+ await audio.play();
69
+ }
70
+ catch (error) {
71
+ throw new Error(`Failed to play sound: ${error.message}`);
72
+ }
73
+ }
63
74
  }
64
75
 
65
76
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst BackgroundGeolocation = registerPlugin(\"BackgroundGeolocation\", {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n});\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class BackgroundGeolocationWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.watchers = new Map();\n this.watcherCounter = 0;\n }\n async addWatcher(options, callback) {\n const watcherId = `watcher_${++this.watcherCounter}`;\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return watcherId;\n }\n const watchId = navigator.geolocation.watchPosition((position) => {\n const location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n }, (error) => {\n const callbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n }, {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n });\n this.watchers.set(watcherId, { watchId, callback });\n return watcherId;\n }\n async removeWatcher(options) {\n const watcher = this.watchers.get(options.id);\n if (watcher) {\n navigator.geolocation.clearWatch(watcher.watchId);\n this.watchers.delete(options.id);\n }\n }\n async openSettings() {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;IACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;IAC5E,CAAC;;ICFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;IACxD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE;IACjC,QAAQ,IAAI,CAAC,cAAc,GAAG,CAAC;IAC/B,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE,QAAQ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a;IACb,YAAY,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAC9C,QAAQ,CAAC,EAAE;IACX,YAAY,kBAAkB,EAAE,IAAI;IACpC,YAAY,OAAO,EAAE,KAAK;IAC1B,YAAY,UAAU,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,GAAG,CAAC;IAClD,SAAS,CAAC;IACV,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC3D,QAAQ,OAAO,SAAS;IACxB,IAAI;IACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;IACjC,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;IACrD,QAAQ,IAAI,OAAO,EAAE;IACrB,YAAY,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7D,YAAY,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5C,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;IACnF,QAAQ,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC;IACnF,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst BackgroundGeolocation = registerPlugin(\"BackgroundGeolocation\", {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n});\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class BackgroundGeolocationWeb extends WebPlugin {\n async start(options, callback) {\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return;\n }\n if (this.watchId) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation already started\",\n code: \"ALREADY_STARTED\",\n });\n return;\n }\n this.watchId = navigator.geolocation.watchPosition((position) => {\n const location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n }, (error) => {\n const callbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n }, {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n });\n }\n async stop() {\n if (this.watchId) {\n navigator.geolocation.clearWatch(this.watchId);\n delete this.watchId;\n }\n }\n async openSettings() {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n async playSound(options) {\n if (!options.soundFile) {\n throw new Error(\"Sound file is required\");\n }\n const audio = new Audio(options.soundFile);\n try {\n await audio.play();\n }\n catch (error) {\n throw new Error(`Failed to play sound: ${error.message}`);\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;IACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;IAC5E,CAAC;;ICFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;IACxD,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE;IACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;IACpC,YAAY,QAAQ,CAAC,SAAS,EAAE;IAChC,gBAAgB,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nCallback);
6
- CAP_PLUGIN_METHOD(removeWatcher, CAPPluginReturnPromise);
5
+ CAP_PLUGIN_METHOD(start, CAPPluginReturnCallback);
6
+ CAP_PLUGIN_METHOD(stop, CAPPluginReturnPromise);
7
7
  CAP_PLUGIN_METHOD(openSettings, CAPPluginReturnPromise);
8
+ CAP_PLUGIN_METHOD(playSound, CAPPluginReturnPromise);
8
9
  )