expo-location 58.0.13 → 58.0.15
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.
- package/CHANGELOG.md +21 -0
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/expo/modules/location/next/LocationModuleNext.kt +189 -10
- package/android/src/main/java/expo/modules/location/next/LocationPermissions.kt +65 -0
- package/android/src/main/java/expo/modules/location/next/LocationRecords.kt +91 -2
- package/android/src/main/java/expo/modules/location/next/LocationTaskConsumer.kt +205 -0
- package/android/src/main/java/expo/modules/location/next/WatchPosition.kt +8 -6
- package/android/src/main/java/expo/modules/location/next/locationForegroundService/BackgroundSessionOptions.kt +62 -0
- package/android/src/main/java/expo/modules/location/next/locationForegroundService/BackgroundSessionTypes.kt +32 -0
- package/android/src/main/java/expo/modules/location/next/locationForegroundService/ForegroundServiceExceptions.kt +53 -0
- package/android/src/main/java/expo/modules/location/next/locationForegroundService/LocationForegroundService.kt +142 -0
- package/android/src/main/java/expo/modules/location/next/locationForegroundService/ServiceNotification.kt +64 -0
- package/android/src/main/java/expo/modules/location/next/locationProviders/AndroidLocationProvider.kt +115 -7
- package/android/src/main/java/expo/modules/location/next/locationProviders/FallbackLocationProvider.kt +12 -3
- package/android/src/main/java/expo/modules/location/next/locationProviders/GmsLocationProvider.kt +79 -0
- package/android/src/main/java/expo/modules/location/next/locationProviders/LocationProvider.kt +48 -0
- package/android/src/main/java/expo/modules/location/taskConsumers/LocationTaskConsumer.kt +6 -0
- package/build/next/index.d.ts +1 -1
- package/build/next/index.js.map +1 -1
- package/build/next/js/LocationProvider.d.ts +35 -0
- package/build/next/js/LocationProvider.js +35 -6
- package/build/next/js/LocationProvider.js.map +1 -1
- package/build/next/js/LocationUpdatesHandle.d.ts +45 -7
- package/build/next/js/LocationUpdatesHandle.js +43 -7
- package/build/next/js/LocationUpdatesHandle.js.map +1 -1
- package/build/next/js/Permissions.d.ts +63 -0
- package/build/next/js/Permissions.js +63 -6
- package/build/next/js/Permissions.js.map +1 -1
- package/build/next/js/PositionWatchHandle.d.ts +78 -0
- package/build/next/js/PositionWatchHandle.js +78 -11
- package/build/next/js/PositionWatchHandle.js.map +1 -1
- package/build/next/js/getPosition.d.ts +26 -1
- package/build/next/js/getPosition.js +26 -2
- package/build/next/js/getPosition.js.map +1 -1
- package/build/next/js/locationServices.d.ts +29 -0
- package/build/next/js/locationServices.js +29 -3
- package/build/next/js/locationServices.js.map +1 -1
- package/build/next/types/LocationTask.types.d.ts +20 -0
- package/build/next/types/LocationTask.types.js +5 -0
- package/build/next/types/LocationTask.types.js.map +1 -0
- package/build/next/types/Permissions.types.d.ts +68 -0
- package/build/next/types/Permissions.types.js +51 -9
- package/build/next/types/Permissions.types.js.map +1 -1
- package/build/next/types/Position.types.d.ts +203 -2
- package/build/next/types/Position.types.js +51 -7
- package/build/next/types/Position.types.js.map +1 -1
- package/build/next/types/index.d.ts +1 -0
- package/build/next/types/index.js +1 -0
- package/build/next/types/index.js.map +1 -1
- package/ios/Providers/LocationsStreamer.swift +10 -4
- package/ios/TaskConsumers/EXGeofencingTaskConsumer.m +16 -1
- package/ios/next/LocationModuleNext.swift +4 -0
- package/ios/next/LocationNextExceptions.swift +0 -8
- package/ios/next/LocationUpdatesHandle/LocationUpdatesHandle.swift +6 -2
- package/ios/next/Position/LocationUpdateDiagnostics.swift +0 -3
- package/ios/next/Position/PositionUpdatesCompatibilitySource.swift +9 -1
- package/ios/next/Position/PositionUpdatesLiveSource.swift +5 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.13/expo.modules.location-58.0.13.module → 58.0.15/expo.modules.location-58.0.15.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.13/expo.modules.location-58.0.13.pom → 58.0.15/expo.modules.location-58.0.15.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.15/expo.modules.location-58.0.15.pom.sha512 +1 -0
- package/package.json +2 -2
- package/plugin/build/withLocation.js +2 -0
- package/plugin/build/withLocation.js.map +1 -1
- package/plugin/src/withLocation.ts +2 -0
- package/src/next/index.ts +1 -0
- package/src/next/js/LocationProvider.ts +35 -0
- package/src/next/js/LocationUpdatesHandle.ts +45 -8
- package/src/next/js/Permissions.ts +63 -0
- package/src/next/js/PositionWatchHandle.ts +78 -0
- package/src/next/js/getPosition.ts +29 -2
- package/src/next/js/locationServices.ts +29 -0
- package/src/next/types/LocationTask.types.ts +22 -0
- package/src/next/types/Permissions.types.ts +68 -0
- package/src/next/types/Position.types.ts +203 -2
- package/src/next/types/index.ts +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.sha512 +0 -1
|
@@ -4,10 +4,25 @@ import { AppState } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { NativeLocationModuleNext } from '../native';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether location services are turned on for the whole device. This is the system toggle,
|
|
9
|
+
* not the app's permission: with services off, no app receives a position even when its permission
|
|
10
|
+
* is granted.
|
|
11
|
+
* See [Handle location services turned off](#handle-location-services-turned-off).
|
|
12
|
+
*/
|
|
7
13
|
export function hasLocationServicesEnabled(): boolean {
|
|
8
14
|
return NativeLocationModuleNext.hasLocationServicesEnabled();
|
|
9
15
|
}
|
|
10
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Asks the user to turn location services on. With the GMS provider, this is an in-app dialog; with
|
|
19
|
+
* the Android provider, it opens the system Settings and resolves when the user returns. Resolves
|
|
20
|
+
* with `true` when services are already on.
|
|
21
|
+
* See [Handle location services turned off](#handle-location-services-turned-off).
|
|
22
|
+
*
|
|
23
|
+
* @return A promise that resolves to `true` when services are on after the user answered.
|
|
24
|
+
* @platform android
|
|
25
|
+
*/
|
|
11
26
|
export async function enableLocationServices(): Promise<boolean> {
|
|
12
27
|
if (Platform.OS !== 'android') {
|
|
13
28
|
throw new UnavailabilityError('expo-location', 'enableLocationServices');
|
|
@@ -16,6 +31,20 @@ export async function enableLocationServices(): Promise<boolean> {
|
|
|
16
31
|
return NativeLocationModuleNext.enableLocationServices();
|
|
17
32
|
}
|
|
18
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Tracks whether location services are on, re-reading the switch every time the app returns to the
|
|
36
|
+
* foreground. `enable` calls `enableLocationServices`, so it works on Android only.
|
|
37
|
+
* See [Handle location services turned off](#handle-location-services-turned-off).
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const [enabled, enable] = useLocationServices();
|
|
42
|
+
*
|
|
43
|
+
* if (!enabled) {
|
|
44
|
+
* return <Button title="Turn on location services" onPress={enable} />;
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
19
48
|
export function useLocationServices(): [enabled: boolean, enable: () => Promise<boolean>] {
|
|
20
49
|
const [enabled, setEnabled] = useState(hasLocationServicesEnabled);
|
|
21
50
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TaskManagerError } from 'expo-task-manager';
|
|
2
|
+
|
|
3
|
+
import type { Position } from './Position.types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The parameters of `defineLocationTask`.
|
|
7
|
+
*/
|
|
8
|
+
export type LocationTaskOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* The name of the task. Must match the name passed to the `LocationUpdatesHandle` constructor;
|
|
11
|
+
* both default to the same name.
|
|
12
|
+
*/
|
|
13
|
+
taskName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Called with every position delivered to the task.
|
|
16
|
+
*/
|
|
17
|
+
onPosition: (position: Position) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Called when the task receives an error instead of a position.
|
|
20
|
+
*/
|
|
21
|
+
onError?: (error: TaskManagerError) => void;
|
|
22
|
+
};
|
|
@@ -1,27 +1,95 @@
|
|
|
1
1
|
import type { PermissionResponse } from 'expo';
|
|
2
2
|
|
|
3
3
|
export enum LocationScope {
|
|
4
|
+
/**
|
|
5
|
+
* On Android, `ACCESS_BACKGROUND_LOCATION` is granted.
|
|
6
|
+
*
|
|
7
|
+
* On iOS, the authorization is `Always`.
|
|
8
|
+
*/
|
|
4
9
|
ALWAYS = 'always',
|
|
10
|
+
/**
|
|
11
|
+
* On Android, `ACCESS_FINE_LOCATION` or `ACCESS_COARSE_LOCATION` is granted, but not
|
|
12
|
+
* `ACCESS_BACKGROUND_LOCATION`.
|
|
13
|
+
*
|
|
14
|
+
* On iOS, the authorization is `When In Use`.
|
|
15
|
+
*/
|
|
5
16
|
WHEN_IN_USE = 'whenInUse',
|
|
17
|
+
/**
|
|
18
|
+
* The app cannot read the location.
|
|
19
|
+
*/
|
|
6
20
|
NOT_GRANTED = 'notGranted',
|
|
7
21
|
}
|
|
8
22
|
|
|
9
23
|
export enum LocationAccuracy {
|
|
24
|
+
/**
|
|
25
|
+
* The app receives the precise location.
|
|
26
|
+
*
|
|
27
|
+
* On Android, `ACCESS_FINE_LOCATION` is granted.
|
|
28
|
+
*
|
|
29
|
+
* On iOS, **Precise Location** is turned on for the app.
|
|
30
|
+
*/
|
|
10
31
|
FULL = 'full',
|
|
32
|
+
/**
|
|
33
|
+
* The app receives an approximate location, accurate to kilometers rather than meters.
|
|
34
|
+
*
|
|
35
|
+
* On Android, only `ACCESS_COARSE_LOCATION` is granted.
|
|
36
|
+
*
|
|
37
|
+
* On iOS, **Precise Location** is turned off for the app.
|
|
38
|
+
*/
|
|
11
39
|
REDUCED = 'reduced',
|
|
40
|
+
/**
|
|
41
|
+
* The app cannot read the location.
|
|
42
|
+
*/
|
|
12
43
|
NOT_GRANTED = 'notGranted',
|
|
13
44
|
}
|
|
14
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The accuracy a permission request asks for.
|
|
48
|
+
*/
|
|
15
49
|
export enum RequestPermissionsAccuracyOption {
|
|
50
|
+
/**
|
|
51
|
+
* Asks for the precise location.
|
|
52
|
+
*
|
|
53
|
+
* On Android, requests `ACCESS_FINE_LOCATION` together with `ACCESS_COARSE_LOCATION`.
|
|
54
|
+
*
|
|
55
|
+
* On iOS, when the app holds a reduced accuracy, shows the system prompt for temporary full
|
|
56
|
+
* accuracy after the permission is granted. The prompt needs the purpose string the config plugin
|
|
57
|
+
* writes by default; `locationFullAccuracyPermission: false` removes it and skips the prompt.
|
|
58
|
+
*/
|
|
16
59
|
FULL = 'full',
|
|
60
|
+
/**
|
|
61
|
+
* Asks for an approximate location only.
|
|
62
|
+
*
|
|
63
|
+
* On Android, requests `ACCESS_COARSE_LOCATION` alone, so the system dialog does not offer the
|
|
64
|
+
* precise option.
|
|
65
|
+
*
|
|
66
|
+
* On iOS, never asks to raise a reduced accuracy.
|
|
67
|
+
*/
|
|
17
68
|
REDUCED = 'reduced',
|
|
18
69
|
}
|
|
19
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Returned by the permission functions, with the location-specific `scope` and `accuracy`.
|
|
73
|
+
*/
|
|
20
74
|
export type LocationPermissionResponse = PermissionResponse & {
|
|
75
|
+
/**
|
|
76
|
+
* When the app can read the location: always, only while in use, or not at all.
|
|
77
|
+
*/
|
|
21
78
|
scope: LocationScope;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the app receives the precise or an approximate location.
|
|
81
|
+
*/
|
|
22
82
|
accuracy: LocationAccuracy;
|
|
23
83
|
};
|
|
24
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Options for [`requestForegroundPermissions`](#requestforegroundpermissionsoptions) and
|
|
87
|
+
* [`requestBackgroundPermissions`](#requestbackgroundpermissionsoptions).
|
|
88
|
+
*/
|
|
25
89
|
export type RequestPermissionsOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* The accuracy to ask for. Ignored by `requestBackgroundPermissions` on Android.
|
|
92
|
+
* @default RequestPermissionsAccuracyOption.FULL
|
|
93
|
+
*/
|
|
26
94
|
accuracy?: RequestPermissionsAccuracyOption;
|
|
27
95
|
};
|
|
@@ -1,58 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A use case that each platform turns into an accuracy, an update interval, and a power budget.
|
|
3
|
+
*
|
|
4
|
+
* On Android it maps to a `LocationRequest` priority and interval.
|
|
5
|
+
*
|
|
6
|
+
* On iOS 17 and later it maps to a `CLLocationUpdate.LiveConfiguration`; on earlier versions to a
|
|
7
|
+
* `CLLocationManager` activity type with the best available accuracy.
|
|
8
|
+
*/
|
|
1
9
|
export enum LocationProfile {
|
|
10
|
+
/**
|
|
11
|
+
* General-purpose positioning, for anything the other profiles do not cover.
|
|
12
|
+
*
|
|
13
|
+
* On Android, balanced priority with updates about every 5 seconds.
|
|
14
|
+
*
|
|
15
|
+
* On iOS, `CLLocationUpdate.LiveConfiguration.default`.
|
|
16
|
+
*/
|
|
2
17
|
DEFAULT = 'default',
|
|
18
|
+
/**
|
|
19
|
+
* Turn-by-turn navigation in a vehicle.
|
|
20
|
+
*
|
|
21
|
+
* On Android, high accuracy with updates about every second.
|
|
22
|
+
*
|
|
23
|
+
* On iOS, `CLLocationUpdate.LiveConfiguration.automotiveNavigation`.
|
|
24
|
+
*/
|
|
3
25
|
AUTOMOTIVE_NAVIGATION = 'automotiveNavigation',
|
|
26
|
+
/**
|
|
27
|
+
* Navigation on foot, by bike, or on water.
|
|
28
|
+
*
|
|
29
|
+
* On Android, high accuracy with updates about every 2 seconds.
|
|
30
|
+
*
|
|
31
|
+
* On iOS, `CLLocationUpdate.LiveConfiguration.otherNavigation`.
|
|
32
|
+
*/
|
|
4
33
|
OTHER_NAVIGATION = 'otherNavigation',
|
|
34
|
+
/**
|
|
35
|
+
* Workout tracking such as running or cycling.
|
|
36
|
+
*
|
|
37
|
+
* On Android, high accuracy with updates about every 2 seconds.
|
|
38
|
+
*
|
|
39
|
+
* On iOS, `CLLocationUpdate.LiveConfiguration.fitness`.
|
|
40
|
+
*/
|
|
5
41
|
FITNESS = 'fitness',
|
|
42
|
+
/**
|
|
43
|
+
* Flying, such as in a plane or a glider.
|
|
44
|
+
*
|
|
45
|
+
* On Android, high accuracy with updates about every second.
|
|
46
|
+
*
|
|
47
|
+
* On iOS, `CLLocationUpdate.LiveConfiguration.airborne`.
|
|
48
|
+
*/
|
|
6
49
|
AIRBORNE = 'airborne',
|
|
50
|
+
/**
|
|
51
|
+
* Coarse position at the lowest power use.
|
|
52
|
+
*
|
|
53
|
+
* On Android, low-power priority with updates about every 60 seconds, which the provider can
|
|
54
|
+
* delay by up to 5 minutes and deliver in batches.
|
|
55
|
+
*
|
|
56
|
+
* On iOS, kilometer accuracy with a 3 km distance filter, on every iOS version.
|
|
57
|
+
*/
|
|
7
58
|
LOW_POWER = 'lowPower',
|
|
8
59
|
}
|
|
9
60
|
|
|
61
|
+
/**
|
|
62
|
+
* A set of coordinates expressed in decimal degrees.
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* {
|
|
66
|
+
* latitude: 40.7128,
|
|
67
|
+
* longitude: -74.0060
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
10
71
|
export type Coordinates = {
|
|
11
72
|
latitude: number;
|
|
12
73
|
longitude: number;
|
|
13
74
|
};
|
|
14
75
|
|
|
76
|
+
/**
|
|
77
|
+
* A single location fix.
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* {
|
|
81
|
+
* coordinates: { latitude: 50.0614, longitude: 19.9372 },
|
|
82
|
+
* horizontalAccuracy: 12.5, // meters
|
|
83
|
+
* timestamp: 1791277756380, // milliseconds since the Unix epoch
|
|
84
|
+
* altitude: 253.1, // meters above the WGS 84 ellipsoid
|
|
85
|
+
* mslAltitude: 212.4, // meters above mean sea level
|
|
86
|
+
* verticalAccuracy: 4.8, // meters
|
|
87
|
+
* mocked: false,
|
|
88
|
+
* heading: 87.3, // degrees clockwise from true north, course over ground
|
|
89
|
+
* headingAccuracy: 5, // degrees
|
|
90
|
+
* speed: 1.4, // meters per second
|
|
91
|
+
* speedAccuracy: 0.3, // meters per second
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
15
95
|
export type Position = {
|
|
96
|
+
/**
|
|
97
|
+
* The latitude and longitude of the fix, in degrees.
|
|
98
|
+
*/
|
|
16
99
|
coordinates: Coordinates;
|
|
100
|
+
/**
|
|
101
|
+
* The radius around `coordinates` within which the device is, in meters.
|
|
102
|
+
*/
|
|
17
103
|
horizontalAccuracy: number | null;
|
|
104
|
+
/**
|
|
105
|
+
* When the fix was taken, in milliseconds since the Unix epoch. Check it when the position must
|
|
106
|
+
* be fresh, because a fix can be older than the moment it was delivered.
|
|
107
|
+
*/
|
|
18
108
|
timestamp: number;
|
|
109
|
+
/**
|
|
110
|
+
* Height above the WGS 84 ellipsoid, in meters.
|
|
111
|
+
*/
|
|
19
112
|
altitude: number | null;
|
|
113
|
+
/**
|
|
114
|
+
* Height above mean sea level, in meters.
|
|
115
|
+
*
|
|
116
|
+
* @platform android 14+
|
|
117
|
+
* @platform ios
|
|
118
|
+
*/
|
|
20
119
|
mslAltitude: number | null;
|
|
120
|
+
/**
|
|
121
|
+
* The uncertainty of `altitude` and `mslAltitude`, in meters.
|
|
122
|
+
*
|
|
123
|
+
* @platform android 8+
|
|
124
|
+
* @platform ios
|
|
125
|
+
*/
|
|
21
126
|
verticalAccuracy: number | null;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the fix comes from a simulated source, such as a simulator or a mock location app.
|
|
129
|
+
*
|
|
130
|
+
* On Android it maps to `Location.isMock` on Android 12 and later and to
|
|
131
|
+
* `Location.isFromMockProvider()` on earlier versions; on iOS to
|
|
132
|
+
* `CLLocation.sourceInformation.isSimulatedBySoftware`.
|
|
133
|
+
*/
|
|
22
134
|
mocked: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* The direction in which the device is traveling, in degrees clockwise from true north,
|
|
137
|
+
* from `0` to `360`. It is unrelated to the device's orientation.
|
|
138
|
+
*/
|
|
23
139
|
heading: number | null;
|
|
140
|
+
/**
|
|
141
|
+
* The uncertainty of `heading`, in degrees.
|
|
142
|
+
*
|
|
143
|
+
* @platform android 8+
|
|
144
|
+
* @platform ios
|
|
145
|
+
*/
|
|
24
146
|
headingAccuracy: number | null;
|
|
147
|
+
/**
|
|
148
|
+
* The speed, in meters per second.
|
|
149
|
+
*/
|
|
25
150
|
speed: number | null;
|
|
151
|
+
/**
|
|
152
|
+
* The uncertainty of `speed`, in meters per second.
|
|
153
|
+
*
|
|
154
|
+
* @platform android 8+
|
|
155
|
+
* @platform ios
|
|
156
|
+
*/
|
|
26
157
|
speedAccuracy: number | null;
|
|
27
158
|
};
|
|
28
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Options for [`getPosition`](#getpositiongetpositionoptions).
|
|
162
|
+
*/
|
|
29
163
|
export type GetPositionOptions = {
|
|
164
|
+
/**
|
|
165
|
+
* The maximum age of a cached location that may be returned.
|
|
166
|
+
* Expressed in seconds.
|
|
167
|
+
*
|
|
168
|
+
* If no new fix arrives within the timeout, `getPosition` returns the cached location
|
|
169
|
+
* regardless of its age.
|
|
170
|
+
* @default 0
|
|
171
|
+
*/
|
|
30
172
|
maxCachedAge?: number;
|
|
173
|
+
/**
|
|
174
|
+
* The maximum time to wait for a new location fix.
|
|
175
|
+
* Expressed in seconds.
|
|
176
|
+
*
|
|
177
|
+
* With a `timeout` of `0`, `getPosition` returns the last known location, if available.
|
|
178
|
+
*
|
|
179
|
+
* On Android, the providers cap it at 30 seconds.
|
|
180
|
+
* @default 30
|
|
181
|
+
*/
|
|
31
182
|
timeout?: number;
|
|
183
|
+
/**
|
|
184
|
+
* The use case the fix is for. It changes the way the location is requested from the OS and can
|
|
185
|
+
* affect accuracy and power usage. On iOS, a reduced accuracy authorization limits the fix
|
|
186
|
+
* whatever the profile; see [Request an approximate location](#request-an-approximate-location).
|
|
187
|
+
* @default LocationProfile.DEFAULT
|
|
188
|
+
*/
|
|
32
189
|
profile?: LocationProfile;
|
|
33
190
|
};
|
|
34
191
|
|
|
192
|
+
/**
|
|
193
|
+
* The reason a watcher stopped delivering positions, passed to `onError`.
|
|
194
|
+
*/
|
|
35
195
|
export type PositionWatchError = {
|
|
196
|
+
/**
|
|
197
|
+
* A stable identifier of the failure, for branching in code.
|
|
198
|
+
*/
|
|
36
199
|
code: string;
|
|
200
|
+
/**
|
|
201
|
+
* A description of the failure, for logs and error screens.
|
|
202
|
+
*/
|
|
37
203
|
message: string;
|
|
38
204
|
};
|
|
39
205
|
|
|
206
|
+
/**
|
|
207
|
+
* One `positionChanged` event from the native watcher: a position or an error, never both.
|
|
208
|
+
*/
|
|
40
209
|
export type PositionUpdate =
|
|
41
210
|
| { data: Position; error: null }
|
|
42
211
|
| { data: null; error: PositionWatchError };
|
|
43
212
|
|
|
213
|
+
/**
|
|
214
|
+
* A snapshot of the watcher's flags, returned by `status()`.
|
|
215
|
+
*/
|
|
44
216
|
export type PositionWatchStatus = {
|
|
45
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Whether the provider is feeding positions right now.
|
|
219
|
+
*/
|
|
46
220
|
isSubscribed: boolean;
|
|
47
|
-
/**
|
|
221
|
+
/**
|
|
222
|
+
* Whether the handle can still be brought back to sending. False only once released.
|
|
223
|
+
*/
|
|
48
224
|
isHandleAlive: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Whether delivery has been started. On Android, it is `true` while at least one listener is
|
|
227
|
+
* attached.
|
|
228
|
+
*/
|
|
49
229
|
isStarted: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Whether `pause()` was called and `resume()` was not called yet.
|
|
232
|
+
*/
|
|
50
233
|
isPaused: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Whether the app is in the foreground. On Android, the watcher holds the system request only
|
|
236
|
+
* while it is `true`.
|
|
237
|
+
*/
|
|
51
238
|
isInForeground: boolean;
|
|
52
239
|
};
|
|
53
240
|
|
|
241
|
+
/**
|
|
242
|
+
* The parameters of `watchPosition`.
|
|
243
|
+
*/
|
|
54
244
|
export type WatchPositionParams = {
|
|
245
|
+
/**
|
|
246
|
+
* The use case the positions are for. It selects the accuracy and the update rate.
|
|
247
|
+
* @default LocationProfile.DEFAULT
|
|
248
|
+
*/
|
|
55
249
|
profile?: LocationProfile;
|
|
250
|
+
/**
|
|
251
|
+
* Called with every delivered position.
|
|
252
|
+
*/
|
|
56
253
|
onPosition: (position: Position) => void;
|
|
254
|
+
/**
|
|
255
|
+
* Called when the watcher cannot deliver positions, for example when the provider refuses the
|
|
256
|
+
* request after the app returns to the foreground.
|
|
257
|
+
*/
|
|
57
258
|
onError?: (error: PositionWatchError) => void;
|
|
58
259
|
};
|
package/src/next/types/index.ts
CHANGED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b6131ece5f5a18998ce0571f54242774
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2376a0dbedbda141dd71a8de6daa7d6c7cbbe4ab
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
36352dc221d755d69fb9a847a78836e1e359ad0443743aaa7f5f2648ddf76f87
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a0bb6a2c55e0c88b6c92553b3a5b05b5b24c604ade8388a46fd758221a2a8b4fb5f2ffb2ad7f3977794932f541aff21f9a5be896510654a963137bbd00ca11e4
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fd583896233d35b7c90515551e9751c6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9784711dc85345dfb3100c08a4061f4121806394
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
30515d0f37957d667880e577c9bc247dfd4e84c9058574413e850893e83c3406
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1d52e7849fe29a33c686fca271fd5b2696ebbb050617ee2d081e3aeae4c4c4a0826fb6b4b8eef4c790ad72aa5d49701cc96c92caacec3e484a3a4930dc45a5c8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
585f591b8edc00660c56ea8256a9664f
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
593547bde190365701ba329c2e4b8a10205da018
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
79b0154c9db5c0d476f7225b33ac7c40a0c7661f356cd16870f4a216ff2a693f
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f7fb35c26e35b5c187829d84abc71228ec8bbefa08ece125cd4feb7a4961edbeca6e8789df4848c74751303a46b33ba8b11e034ca1a5880d5bad7f35e712dde5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
35cc85505e7dfd6d984fca92c612b609
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b170440ec0fba727b6ebe34501aa3aa5d8bba924
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9c7add2e11db5f0b33aca67f7f623c58d7863272f8ad5595a42bd2fef831917e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
353c6484d0224b8655cd47f7b0be7d9efd3e1ff9d8873532d7a2a5f8d565e2cf532e446d3a77836a213455b509448a1f6bfde10fa852a1e2fbcbe684d4f7e170
|