expo-location 15.1.1 → 15.2.0
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 +4 -0
- package/README.md +2 -2
- package/android/build.gradle +2 -2
- package/build/Location.d.ts +1 -1
- package/build/Location.js +1 -1
- package/build/Location.js.map +1 -1
- package/build/Location.types.d.ts +2 -2
- package/build/Location.types.js.map +1 -1
- package/package.json +2 -2
- package/src/Location.ts +1 -1
- package/src/Location.types.ts +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Allows reading geolocation information from the device. Your app can poll for th
|
|
|
16
16
|
|
|
17
17
|
# Installation in managed Expo projects
|
|
18
18
|
|
|
19
|
-
For [managed](https://docs.expo.dev/
|
|
19
|
+
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/location/).
|
|
20
20
|
|
|
21
21
|
# Installation in bare React Native projects
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ For bare React Native projects, you must ensure that you have [installed and con
|
|
|
25
25
|
### Add the package to your npm dependencies
|
|
26
26
|
|
|
27
27
|
```
|
|
28
|
-
expo install expo-location
|
|
28
|
+
npx expo install expo-location
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
### Configure for iOS
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '15.
|
|
6
|
+
version = '15.2.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -74,7 +74,7 @@ android {
|
|
|
74
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
75
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
76
76
|
versionCode 29
|
|
77
|
-
versionName "15.
|
|
77
|
+
versionName "15.2.0"
|
|
78
78
|
}
|
|
79
79
|
lintOptions {
|
|
80
80
|
abortOnError false
|
package/build/Location.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export declare function getBackgroundPermissionsAsync(): Promise<PermissionRespo
|
|
|
135
135
|
*/
|
|
136
136
|
export declare function requestBackgroundPermissionsAsync(): Promise<PermissionResponse>;
|
|
137
137
|
/**
|
|
138
|
-
* Check or request permissions for the
|
|
138
|
+
* Check or request permissions for the background location.
|
|
139
139
|
* This uses both `requestBackgroundPermissionsAsync` and `getBackgroundPermissionsAsync` to
|
|
140
140
|
* interact with the permissions.
|
|
141
141
|
*
|
package/build/Location.js
CHANGED
|
@@ -229,7 +229,7 @@ export async function requestBackgroundPermissionsAsync() {
|
|
|
229
229
|
}
|
|
230
230
|
// @needsAudit
|
|
231
231
|
/**
|
|
232
|
-
* Check or request permissions for the
|
|
232
|
+
* Check or request permissions for the background location.
|
|
233
233
|
* This uses both `requestBackgroundPermissionsAsync` and `getBackgroundPermissionsAsync` to
|
|
234
234
|
* interact with the permissions.
|
|
235
235
|
*
|
package/build/Location.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../src/Location.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,oBAAoB,EACpB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAchB,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,GAE9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;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AAY,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,QAAgB;IAC9D,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,YAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED,OAAO,EAAE,oBAAoB,IAAI,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEpE,OAAO,EACL,gBAAgB,IAAI,QAAQ,EAC5B,oBAAoB,IAAI,YAAY,EACpC,2BAA2B,IAAI,mBAAmB,EAClD,6BAA6B,IAAI,qBAAqB,EACtD,gBAAgB,EAEhB,eAAe,GAChB,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,cAAc,kBAAkB,CAAC","sourcesContent":["import {\n PermissionStatus,\n PermissionResponse,\n PermissionHookOptions,\n createPermissionHook,\n Platform,\n} from 'expo-modules-core';\n\nimport ExpoLocation from './ExpoLocation';\nimport {\n LocationAccuracy,\n LocationCallback,\n LocationGeocodedAddress,\n LocationGeocodedLocation,\n LocationHeadingCallback,\n LocationHeadingObject,\n LocationLastKnownOptions,\n LocationObject,\n LocationOptions,\n LocationPermissionResponse,\n LocationProviderStatus,\n LocationRegion,\n LocationSubscription,\n LocationTaskOptions,\n LocationActivityType,\n LocationGeofencingEventType,\n LocationGeofencingRegionState,\n LocationGeocodingOptions,\n} from './Location.types';\nimport { LocationEventEmitter } from './LocationEventEmitter';\nimport {\n setGoogleApiKey,\n googleGeocodeAsync,\n googleReverseGeocodeAsync,\n} from './LocationGoogleGeocoding';\nimport { LocationSubscriber, HeadingSubscriber, _getCurrentWatchId } from './LocationSubscribers';\n\n// @needsAudit\n/**\n * Check status of location providers.\n * @return A promise which fulfills with an object of type [LocationProviderStatus](#locationproviderstatus).\n */\nexport async function getProviderStatusAsync(): Promise<LocationProviderStatus> {\n return ExpoLocation.getProviderStatusAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to turn on high accuracy location mode which enables network provider that uses\n * Google Play services to improve location accuracy and location-based services.\n * @return A promise resolving as soon as the user accepts the dialog. Rejects if denied.\n */\nexport async function enableNetworkProviderAsync(): Promise<void> {\n // If network provider is disabled (user's location mode is set to \"Device only\"),\n // Android's location provider may not give you any results. Use this method in order to ask the user\n // to change the location mode to \"High accuracy\" which uses Google Play services and enables network provider.\n // `getCurrentPositionAsync` and `watchPositionAsync` are doing it automatically anyway.\n\n if (Platform.OS === 'android') {\n return ExpoLocation.enableNetworkProviderAsync();\n }\n}\n\n// @needsAudit\n/**\n * Requests for one-time delivery of the user's current location.\n * Depending on given `accuracy` option it may take some time to resolve,\n * especially when you're inside a building.\n * > __Note:__ Calling it causes the location manager to obtain a location fix which may take several\n * > seconds. Consider using [`Location.getLastKnownPositionAsync`](#locationgetlastknownpositionasyncoptions)\n * > if you expect to get a quick response and high accuracy is not required.\n * @param options\n * @return A promise which fulfills with an object of type [`LocationObject`](#locationobject).\n */\nexport async function getCurrentPositionAsync(\n options: LocationOptions = {}\n): Promise<LocationObject> {\n return ExpoLocation.getCurrentPositionAsync(options);\n}\n\n// @needsAudit\n/**\n * Gets the last known position of the device or `null` if it's not available or doesn't match given\n * requirements such as maximum age or required accuracy.\n * It's considered to be faster than `getCurrentPositionAsync` as it doesn't request for the current\n * location, but keep in mind the returned location may not be up-to-date.\n * @param options\n * @return A promise which fulfills with an object of type [LocationObject](#locationobject) or\n * `null` if it's not available or doesn't match given requirements such as maximum age or required\n * accuracy.\n */\nexport async function getLastKnownPositionAsync(\n options: LocationLastKnownOptions = {}\n): Promise<LocationObject | null> {\n return ExpoLocation.getLastKnownPositionAsync(options);\n}\n\n// @needsAudit\n/**\n * Subscribe to location updates from the device. Please note that updates will only occur while the\n * application is in the foreground. To get location updates while in background you'll need to use\n * [Location.startLocationUpdatesAsync](#locationstartlocationupdatesasynctaskname-options).\n * @param options\n * @param callback This function is called on each location update. It receives an object of type\n * [`LocationObject`](#locationobject) as the first argument.\n * @return A promise which fulfills with a [`LocationSubscription`](#locationsubscription) object.\n */\nexport async function watchPositionAsync(\n options: LocationOptions,\n callback: LocationCallback\n): Promise<LocationSubscription> {\n const watchId = LocationSubscriber.registerCallback(callback);\n await ExpoLocation.watchPositionImplAsync(watchId, options);\n\n return {\n remove() {\n LocationSubscriber.unregisterCallback(watchId);\n },\n };\n}\n\n// @needsAudit\n/**\n * Gets the current heading information from the device. To simplify, it calls `watchHeadingAsync`\n * and waits for a couple of updates, and then returns the one that is accurate enough.\n * @return A promise which fulfills with an object of type [LocationHeadingObject](#locationheadingobject).\n */\nexport async function getHeadingAsync(): Promise<LocationHeadingObject> {\n return new Promise(async (resolve) => {\n let tries = 0;\n\n const subscription = await watchHeadingAsync((heading) => {\n if (heading.accuracy > 1 || tries > 5) {\n subscription.remove();\n resolve(heading);\n } else {\n tries += 1;\n }\n });\n });\n}\n\n// @needsAudit\n/**\n * Subscribe to compass updates from the device.\n * @param callback This function is called on each compass update. It receives an object of type\n * [LocationHeadingObject](#locationheadingobject) as the first argument.\n * @return A promise which fulfills with a [`LocationSubscription`](#locationsubscription) object.\n */\nexport async function watchHeadingAsync(\n callback: LocationHeadingCallback\n): Promise<LocationSubscription> {\n const watchId = HeadingSubscriber.registerCallback(callback);\n await ExpoLocation.watchDeviceHeading(watchId);\n\n return {\n remove() {\n HeadingSubscriber.unregisterCallback(watchId);\n },\n };\n}\n\n// @needsAudit\n/**\n * Geocode an address string to latitude-longitude location.\n * > **Note**: Geocoding is resource consuming and has to be used reasonably. Creating too many\n * > requests at a time can result in an error, so they have to be managed properly.\n * > It's also discouraged to use geocoding while the app is in the background and its results won't\n * > be shown to the user immediately.\n *\n * > On Android, you must request a location permission (`Permissions.LOCATION`) from the user\n * > before geocoding can be used.\n * @param address A string representing address, eg. `\"Baker Street London\"`.\n * @param options\n * @return A promise which fulfills with an array (in most cases its size is 1) of [`LocationGeocodedLocation`](#locationgeocodedlocation) objects.\n */\nexport async function geocodeAsync(\n address: string,\n options?: LocationGeocodingOptions\n): Promise<LocationGeocodedLocation[]> {\n if (typeof address !== 'string') {\n throw new TypeError(`Address to geocode must be a string. Got ${address} instead.`);\n }\n if (options?.useGoogleMaps || Platform.OS === 'web') {\n return await googleGeocodeAsync(address);\n }\n return await ExpoLocation.geocodeAsync(address);\n}\n\n// @needsAudit\n/**\n * Reverse geocode a location to postal address.\n * > **Note**: Geocoding is resource consuming and has to be used reasonably. Creating too many\n * > requests at a time can result in an error, so they have to be managed properly.\n * > It's also discouraged to use geocoding while the app is in the background and its results won't\n * > be shown to the user immediately.\n *\n * > On Android, you must request a location permission (`Permissions.LOCATION`) from the user\n * > before geocoding can be used.\n * @param location An object representing a location.\n * @param options\n * @return A promise which fulfills with an array (in most cases its size is 1) of [`LocationGeocodedAddress`](#locationgeocodedaddress) objects.\n */\nexport async function reverseGeocodeAsync(\n location: Pick<LocationGeocodedLocation, 'latitude' | 'longitude'>,\n options?: LocationGeocodingOptions\n): Promise<LocationGeocodedAddress[]> {\n if (typeof location.latitude !== 'number' || typeof location.longitude !== 'number') {\n throw new TypeError(\n 'Location to reverse-geocode must be an object with number properties `latitude` and `longitude`.'\n );\n }\n if (options?.useGoogleMaps || Platform.OS === 'web') {\n return await googleReverseGeocodeAsync(location);\n }\n return await ExpoLocation.reverseGeocodeAsync(location);\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing location.\n * @return A promise that fulfills with an object of type [LocationPermissionResponse](#locationpermissionresponse).\n * @deprecated Use [`getForegroundPermissionsAsync`](#locationgetforegroundpermissionsasync) or [`getBackgroundPermissionsAsync`](#locationgetbackgroundpermissionsasync) instead.\n */\nexport async function getPermissionsAsync(): Promise<LocationPermissionResponse> {\n console.warn(\n `\"getPermissionsAsync()\" is now deprecated. Please use \"getForegroundPermissionsAsync()\" or \"getBackgroundPermissionsAsync()\" instead.`\n );\n return await ExpoLocation.getPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for location.\n * @return A promise that fulfills with an object of type [LocationPermissionResponse](#locationpermissionresponse).\n * @deprecated Use [`requestForegroundPermissionsAsync`](#locationrequestforegroundpermissionsasync) or [`requestBackgroundPermissionsAsync`](#locationrequestbackgroundpermissionsasync) instead.\n */\nexport async function requestPermissionsAsync(): Promise<LocationPermissionResponse> {\n console.warn(\n `\"requestPermissionsAsync()\" is now deprecated. Please use \"requestForegroundPermissionsAsync()\" or \"requestBackgroundPermissionsAsync()\" instead.`\n );\n\n return await ExpoLocation.requestPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing location while the app is in the foreground.\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function getForegroundPermissionsAsync(): Promise<LocationPermissionResponse> {\n return await ExpoLocation.getForegroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for location while the app is in the foreground.\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function requestForegroundPermissionsAsync(): Promise<LocationPermissionResponse> {\n return await ExpoLocation.requestForegroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions for the foreground location.\n * This uses both `requestForegroundPermissionsAsync` and `getForegroundPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Location.useForegroundPermissions();\n * ```\n */\nexport const useForegroundPermissions = createPermissionHook({\n getMethod: getForegroundPermissionsAsync,\n requestMethod: requestForegroundPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing location while the app is in the background.\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function getBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return await ExpoLocation.getBackgroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for location while the app is in the background.\n * On __Android 11 or higher__: this method will open the system settings page - before that happens\n * you should explain to the user why your application needs background location permission.\n * For example, you can use `Modal` component from `react-native` to do that.\n * > __Note__: Foreground permissions should be granted before asking for the background permissions\n * (your app can't obtain background permission without foreground permission).\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function requestBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return await ExpoLocation.requestBackgroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions for the foreground location.\n * This uses both `requestBackgroundPermissionsAsync` and `getBackgroundPermissionsAsync` to\n * interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Location.useBackgroundPermissions();\n * ```\n */\nexport const useBackgroundPermissions = createPermissionHook({\n getMethod: getBackgroundPermissionsAsync,\n requestMethod: requestBackgroundPermissionsAsync,\n});\n\n// --- Location service\n\n// @needsAudit\n/**\n * Checks whether location services are enabled by the user.\n * @return A promise which fulfills to `true` if location services are enabled on the device,\n * or `false` if not.\n */\nexport async function hasServicesEnabledAsync(): Promise<boolean> {\n return await ExpoLocation.hasServicesEnabledAsync();\n}\n\n// --- Background location updates\n\nfunction _validateTaskName(taskName: string) {\n if (!taskName || typeof taskName !== 'string') {\n throw new Error(`\\`taskName\\` must be a non-empty string. Got ${taskName} instead.`);\n }\n}\n\n// @docsMissing\nexport async function isBackgroundLocationAvailableAsync(): Promise<boolean> {\n const providerStatus = await getProviderStatusAsync();\n return providerStatus.backgroundModeEnabled;\n}\n\n// @needsAudit\n/**\n * Registers for receiving location updates that can also come when the app is in the background.\n *\n * # Task parameters\n *\n * Background location task will be receiving following data:\n * - `locations` - An array of the new locations.\n *\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n *\n * TaskManager.defineTask(YOUR_TASK_NAME, ({ data: { locations }, error }) => {\n * if (error) {\n * // check `error.message` for more details.\n * return;\n * }\n * console.log('Received new locations', locations);\n * });\n * ```\n *\n * @param taskName Name of the task receiving location updates.\n * @param options An object of options passed to the location manager.\n *\n * @return A promise resolving once the task with location updates is registered.\n */\nexport async function startLocationUpdatesAsync(\n taskName: string,\n options: LocationTaskOptions = { accuracy: LocationAccuracy.Balanced }\n): Promise<void> {\n _validateTaskName(taskName);\n await ExpoLocation.startLocationUpdatesAsync(taskName, options);\n}\n\n// @needsAudit\n/**\n * Stops geofencing for specified task.\n * @param taskName Name of the background location task to stop.\n * @return A promise resolving as soon as the task is unregistered.\n */\nexport async function stopLocationUpdatesAsync(taskName: string): Promise<void> {\n _validateTaskName(taskName);\n await ExpoLocation.stopLocationUpdatesAsync(taskName);\n}\n\n// @needsAudit\n/**\n * @param taskName Name of the location task to check.\n * @return A promise which fulfills with boolean value indicating whether the location task is\n * started or not.\n */\nexport async function hasStartedLocationUpdatesAsync(taskName: string): Promise<boolean> {\n _validateTaskName(taskName);\n return ExpoLocation.hasStartedLocationUpdatesAsync(taskName);\n}\n\n// --- Geofencing\n\nfunction _validateRegions(regions: LocationRegion[]) {\n if (!regions || regions.length === 0) {\n throw new Error(\n 'Regions array cannot be empty. Use `stopGeofencingAsync` if you want to stop geofencing all regions'\n );\n }\n for (const region of regions) {\n if (typeof region.latitude !== 'number') {\n throw new TypeError(`Region's latitude must be a number. Got '${region.latitude}' instead.`);\n }\n if (typeof region.longitude !== 'number') {\n throw new TypeError(\n `Region's longitude must be a number. Got '${region.longitude}' instead.`\n );\n }\n if (typeof region.radius !== 'number') {\n throw new TypeError(`Region's radius must be a number. Got '${region.radius}' instead.`);\n }\n }\n}\n\n// @needsAudit\n/**\n * Starts geofencing for given regions. When the new event comes, the task with specified name will\n * be called with the region that the device enter to or exit from.\n * If you want to add or remove regions from already running geofencing task, you can just call\n * `startGeofencingAsync` again with the new array of regions.\n *\n * # Task parameters\n *\n * Geofencing task will be receiving following data:\n * - `eventType` - Indicates the reason for calling the task, which can be triggered by entering or exiting the region.\n * See [GeofencingEventType](#geofencingeventtype).\n * - `region` - Object containing details about updated region. See [LocationRegion](#locationregion) for more details.\n *\n * @param taskName Name of the task that will be called when the device enters or exits from specified regions.\n * @param regions Array of region objects to be geofenced.\n *\n * @return A promise resolving as soon as the task is registered.\n *\n * @example\n * ```ts\n * import { GeofencingEventType } from 'expo-location';\n * import * as TaskManager from 'expo-task-manager';\n *\n * TaskManager.defineTask(YOUR_TASK_NAME, ({ data: { eventType, region }, error }) => {\n * if (error) {\n * // check `error.message` for more details.\n * return;\n * }\n * if (eventType === GeofencingEventType.Enter) {\n * console.log(\"You've entered region:\", region);\n * } else if (eventType === GeofencingEventType.Exit) {\n * console.log(\"You've left region:\", region);\n * }\n * });\n * ```\n */\nexport async function startGeofencingAsync(\n taskName: string,\n regions: LocationRegion[] = []\n): Promise<void> {\n _validateTaskName(taskName);\n _validateRegions(regions);\n await ExpoLocation.startGeofencingAsync(taskName, { regions });\n}\n\n// @needsAudit\n/**\n * Stops geofencing for specified task. It unregisters the background task so the app will not be\n * receiving any updates, especially in the background.\n * @param taskName Name of the task to unregister.\n * @return A promise resolving as soon as the task is unregistered.\n */\nexport async function stopGeofencingAsync(taskName: string): Promise<void> {\n _validateTaskName(taskName);\n await ExpoLocation.stopGeofencingAsync(taskName);\n}\n\n// @needsAudit\n/**\n * @param taskName Name of the geofencing task to check.\n * @return A promise which fulfills with boolean value indicating whether the geofencing task is\n * started or not.\n */\nexport async function hasStartedGeofencingAsync(taskName: string): Promise<boolean> {\n _validateTaskName(taskName);\n return ExpoLocation.hasStartedGeofencingAsync(taskName);\n}\n\nexport { LocationEventEmitter as EventEmitter, _getCurrentWatchId };\n\nexport {\n LocationAccuracy as Accuracy,\n LocationActivityType as ActivityType,\n LocationGeofencingEventType as GeofencingEventType,\n LocationGeofencingRegionState as GeofencingRegionState,\n PermissionStatus,\n PermissionHookOptions,\n setGoogleApiKey,\n};\n\nexport { installWebGeolocationPolyfill } from './GeolocationPolyfill';\nexport * from './Location.types';\n"]}
|
|
1
|
+
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../src/Location.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,oBAAoB,EACpB,QAAQ,GACT,MAAM,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,QAAQ,CAAC,CAAC;IAC5B,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1B,MAAM,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACxD,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC5B,MAAM,YAAY,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,QAAgB;IAC9D,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,YAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED,OAAO,EAAE,oBAAoB,IAAI,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEpE,OAAO,EACL,gBAAgB,IAAI,QAAQ,EAC5B,oBAAoB,IAAI,YAAY,EACpC,2BAA2B,IAAI,mBAAmB,EAClD,6BAA6B,IAAI,qBAAqB,EACtD,gBAAgB,EAEhB,eAAe,GAChB,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,cAAc,kBAAkB,CAAC","sourcesContent":["import {\n PermissionStatus,\n PermissionResponse,\n PermissionHookOptions,\n createPermissionHook,\n Platform,\n} from 'expo-modules-core';\n\nimport ExpoLocation from './ExpoLocation';\nimport {\n LocationAccuracy,\n LocationCallback,\n LocationGeocodedAddress,\n LocationGeocodedLocation,\n LocationHeadingCallback,\n LocationHeadingObject,\n LocationLastKnownOptions,\n LocationObject,\n LocationOptions,\n LocationPermissionResponse,\n LocationProviderStatus,\n LocationRegion,\n LocationSubscription,\n LocationTaskOptions,\n LocationActivityType,\n LocationGeofencingEventType,\n LocationGeofencingRegionState,\n LocationGeocodingOptions,\n} from './Location.types';\nimport { LocationEventEmitter } from './LocationEventEmitter';\nimport {\n setGoogleApiKey,\n googleGeocodeAsync,\n googleReverseGeocodeAsync,\n} from './LocationGoogleGeocoding';\nimport { LocationSubscriber, HeadingSubscriber, _getCurrentWatchId } from './LocationSubscribers';\n\n// @needsAudit\n/**\n * Check status of location providers.\n * @return A promise which fulfills with an object of type [LocationProviderStatus](#locationproviderstatus).\n */\nexport async function getProviderStatusAsync(): Promise<LocationProviderStatus> {\n return ExpoLocation.getProviderStatusAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to turn on high accuracy location mode which enables network provider that uses\n * Google Play services to improve location accuracy and location-based services.\n * @return A promise resolving as soon as the user accepts the dialog. Rejects if denied.\n */\nexport async function enableNetworkProviderAsync(): Promise<void> {\n // If network provider is disabled (user's location mode is set to \"Device only\"),\n // Android's location provider may not give you any results. Use this method in order to ask the user\n // to change the location mode to \"High accuracy\" which uses Google Play services and enables network provider.\n // `getCurrentPositionAsync` and `watchPositionAsync` are doing it automatically anyway.\n\n if (Platform.OS === 'android') {\n return ExpoLocation.enableNetworkProviderAsync();\n }\n}\n\n// @needsAudit\n/**\n * Requests for one-time delivery of the user's current location.\n * Depending on given `accuracy` option it may take some time to resolve,\n * especially when you're inside a building.\n * > __Note:__ Calling it causes the location manager to obtain a location fix which may take several\n * > seconds. Consider using [`Location.getLastKnownPositionAsync`](#locationgetlastknownpositionasyncoptions)\n * > if you expect to get a quick response and high accuracy is not required.\n * @param options\n * @return A promise which fulfills with an object of type [`LocationObject`](#locationobject).\n */\nexport async function getCurrentPositionAsync(\n options: LocationOptions = {}\n): Promise<LocationObject> {\n return ExpoLocation.getCurrentPositionAsync(options);\n}\n\n// @needsAudit\n/**\n * Gets the last known position of the device or `null` if it's not available or doesn't match given\n * requirements such as maximum age or required accuracy.\n * It's considered to be faster than `getCurrentPositionAsync` as it doesn't request for the current\n * location, but keep in mind the returned location may not be up-to-date.\n * @param options\n * @return A promise which fulfills with an object of type [LocationObject](#locationobject) or\n * `null` if it's not available or doesn't match given requirements such as maximum age or required\n * accuracy.\n */\nexport async function getLastKnownPositionAsync(\n options: LocationLastKnownOptions = {}\n): Promise<LocationObject | null> {\n return ExpoLocation.getLastKnownPositionAsync(options);\n}\n\n// @needsAudit\n/**\n * Subscribe to location updates from the device. Please note that updates will only occur while the\n * application is in the foreground. To get location updates while in background you'll need to use\n * [Location.startLocationUpdatesAsync](#locationstartlocationupdatesasynctaskname-options).\n * @param options\n * @param callback This function is called on each location update. It receives an object of type\n * [`LocationObject`](#locationobject) as the first argument.\n * @return A promise which fulfills with a [`LocationSubscription`](#locationsubscription) object.\n */\nexport async function watchPositionAsync(\n options: LocationOptions,\n callback: LocationCallback\n): Promise<LocationSubscription> {\n const watchId = LocationSubscriber.registerCallback(callback);\n await ExpoLocation.watchPositionImplAsync(watchId, options);\n\n return {\n remove() {\n LocationSubscriber.unregisterCallback(watchId);\n },\n };\n}\n\n// @needsAudit\n/**\n * Gets the current heading information from the device. To simplify, it calls `watchHeadingAsync`\n * and waits for a couple of updates, and then returns the one that is accurate enough.\n * @return A promise which fulfills with an object of type [LocationHeadingObject](#locationheadingobject).\n */\nexport async function getHeadingAsync(): Promise<LocationHeadingObject> {\n return new Promise(async (resolve) => {\n let tries = 0;\n\n const subscription = await watchHeadingAsync((heading) => {\n if (heading.accuracy > 1 || tries > 5) {\n subscription.remove();\n resolve(heading);\n } else {\n tries += 1;\n }\n });\n });\n}\n\n// @needsAudit\n/**\n * Subscribe to compass updates from the device.\n * @param callback This function is called on each compass update. It receives an object of type\n * [LocationHeadingObject](#locationheadingobject) as the first argument.\n * @return A promise which fulfills with a [`LocationSubscription`](#locationsubscription) object.\n */\nexport async function watchHeadingAsync(\n callback: LocationHeadingCallback\n): Promise<LocationSubscription> {\n const watchId = HeadingSubscriber.registerCallback(callback);\n await ExpoLocation.watchDeviceHeading(watchId);\n\n return {\n remove() {\n HeadingSubscriber.unregisterCallback(watchId);\n },\n };\n}\n\n// @needsAudit\n/**\n * Geocode an address string to latitude-longitude location.\n * > **Note**: Geocoding is resource consuming and has to be used reasonably. Creating too many\n * > requests at a time can result in an error, so they have to be managed properly.\n * > It's also discouraged to use geocoding while the app is in the background and its results won't\n * > be shown to the user immediately.\n *\n * > On Android, you must request a location permission (`Permissions.LOCATION`) from the user\n * > before geocoding can be used.\n * @param address A string representing address, eg. `\"Baker Street London\"`.\n * @param options\n * @return A promise which fulfills with an array (in most cases its size is 1) of [`LocationGeocodedLocation`](#locationgeocodedlocation) objects.\n */\nexport async function geocodeAsync(\n address: string,\n options?: LocationGeocodingOptions\n): Promise<LocationGeocodedLocation[]> {\n if (typeof address !== 'string') {\n throw new TypeError(`Address to geocode must be a string. Got ${address} instead.`);\n }\n if (options?.useGoogleMaps || Platform.OS === 'web') {\n return await googleGeocodeAsync(address);\n }\n return await ExpoLocation.geocodeAsync(address);\n}\n\n// @needsAudit\n/**\n * Reverse geocode a location to postal address.\n * > **Note**: Geocoding is resource consuming and has to be used reasonably. Creating too many\n * > requests at a time can result in an error, so they have to be managed properly.\n * > It's also discouraged to use geocoding while the app is in the background and its results won't\n * > be shown to the user immediately.\n *\n * > On Android, you must request a location permission (`Permissions.LOCATION`) from the user\n * > before geocoding can be used.\n * @param location An object representing a location.\n * @param options\n * @return A promise which fulfills with an array (in most cases its size is 1) of [`LocationGeocodedAddress`](#locationgeocodedaddress) objects.\n */\nexport async function reverseGeocodeAsync(\n location: Pick<LocationGeocodedLocation, 'latitude' | 'longitude'>,\n options?: LocationGeocodingOptions\n): Promise<LocationGeocodedAddress[]> {\n if (typeof location.latitude !== 'number' || typeof location.longitude !== 'number') {\n throw new TypeError(\n 'Location to reverse-geocode must be an object with number properties `latitude` and `longitude`.'\n );\n }\n if (options?.useGoogleMaps || Platform.OS === 'web') {\n return await googleReverseGeocodeAsync(location);\n }\n return await ExpoLocation.reverseGeocodeAsync(location);\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing location.\n * @return A promise that fulfills with an object of type [LocationPermissionResponse](#locationpermissionresponse).\n * @deprecated Use [`getForegroundPermissionsAsync`](#locationgetforegroundpermissionsasync) or [`getBackgroundPermissionsAsync`](#locationgetbackgroundpermissionsasync) instead.\n */\nexport async function getPermissionsAsync(): Promise<LocationPermissionResponse> {\n console.warn(\n `\"getPermissionsAsync()\" is now deprecated. Please use \"getForegroundPermissionsAsync()\" or \"getBackgroundPermissionsAsync()\" instead.`\n );\n return await ExpoLocation.getPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for location.\n * @return A promise that fulfills with an object of type [LocationPermissionResponse](#locationpermissionresponse).\n * @deprecated Use [`requestForegroundPermissionsAsync`](#locationrequestforegroundpermissionsasync) or [`requestBackgroundPermissionsAsync`](#locationrequestbackgroundpermissionsasync) instead.\n */\nexport async function requestPermissionsAsync(): Promise<LocationPermissionResponse> {\n console.warn(\n `\"requestPermissionsAsync()\" is now deprecated. Please use \"requestForegroundPermissionsAsync()\" or \"requestBackgroundPermissionsAsync()\" instead.`\n );\n\n return await ExpoLocation.requestPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing location while the app is in the foreground.\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function getForegroundPermissionsAsync(): Promise<LocationPermissionResponse> {\n return await ExpoLocation.getForegroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for location while the app is in the foreground.\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function requestForegroundPermissionsAsync(): Promise<LocationPermissionResponse> {\n return await ExpoLocation.requestForegroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions for the foreground location.\n * This uses both `requestForegroundPermissionsAsync` and `getForegroundPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Location.useForegroundPermissions();\n * ```\n */\nexport const useForegroundPermissions = createPermissionHook({\n getMethod: getForegroundPermissionsAsync,\n requestMethod: requestForegroundPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing location while the app is in the background.\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function getBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return await ExpoLocation.getBackgroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for location while the app is in the background.\n * On __Android 11 or higher__: this method will open the system settings page - before that happens\n * you should explain to the user why your application needs background location permission.\n * For example, you can use `Modal` component from `react-native` to do that.\n * > __Note__: Foreground permissions should be granted before asking for the background permissions\n * (your app can't obtain background permission without foreground permission).\n * @return A promise that fulfills with an object of type [PermissionResponse](#permissionresponse).\n */\nexport async function requestBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return await ExpoLocation.requestBackgroundPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions for the background location.\n * This uses both `requestBackgroundPermissionsAsync` and `getBackgroundPermissionsAsync` to\n * interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Location.useBackgroundPermissions();\n * ```\n */\nexport const useBackgroundPermissions = createPermissionHook({\n getMethod: getBackgroundPermissionsAsync,\n requestMethod: requestBackgroundPermissionsAsync,\n});\n\n// --- Location service\n\n// @needsAudit\n/**\n * Checks whether location services are enabled by the user.\n * @return A promise which fulfills to `true` if location services are enabled on the device,\n * or `false` if not.\n */\nexport async function hasServicesEnabledAsync(): Promise<boolean> {\n return await ExpoLocation.hasServicesEnabledAsync();\n}\n\n// --- Background location updates\n\nfunction _validateTaskName(taskName: string) {\n if (!taskName || typeof taskName !== 'string') {\n throw new Error(`\\`taskName\\` must be a non-empty string. Got ${taskName} instead.`);\n }\n}\n\n// @docsMissing\nexport async function isBackgroundLocationAvailableAsync(): Promise<boolean> {\n const providerStatus = await getProviderStatusAsync();\n return providerStatus.backgroundModeEnabled;\n}\n\n// @needsAudit\n/**\n * Registers for receiving location updates that can also come when the app is in the background.\n *\n * # Task parameters\n *\n * Background location task will be receiving following data:\n * - `locations` - An array of the new locations.\n *\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n *\n * TaskManager.defineTask(YOUR_TASK_NAME, ({ data: { locations }, error }) => {\n * if (error) {\n * // check `error.message` for more details.\n * return;\n * }\n * console.log('Received new locations', locations);\n * });\n * ```\n *\n * @param taskName Name of the task receiving location updates.\n * @param options An object of options passed to the location manager.\n *\n * @return A promise resolving once the task with location updates is registered.\n */\nexport async function startLocationUpdatesAsync(\n taskName: string,\n options: LocationTaskOptions = { accuracy: LocationAccuracy.Balanced }\n): Promise<void> {\n _validateTaskName(taskName);\n await ExpoLocation.startLocationUpdatesAsync(taskName, options);\n}\n\n// @needsAudit\n/**\n * Stops geofencing for specified task.\n * @param taskName Name of the background location task to stop.\n * @return A promise resolving as soon as the task is unregistered.\n */\nexport async function stopLocationUpdatesAsync(taskName: string): Promise<void> {\n _validateTaskName(taskName);\n await ExpoLocation.stopLocationUpdatesAsync(taskName);\n}\n\n// @needsAudit\n/**\n * @param taskName Name of the location task to check.\n * @return A promise which fulfills with boolean value indicating whether the location task is\n * started or not.\n */\nexport async function hasStartedLocationUpdatesAsync(taskName: string): Promise<boolean> {\n _validateTaskName(taskName);\n return ExpoLocation.hasStartedLocationUpdatesAsync(taskName);\n}\n\n// --- Geofencing\n\nfunction _validateRegions(regions: LocationRegion[]) {\n if (!regions || regions.length === 0) {\n throw new Error(\n 'Regions array cannot be empty. Use `stopGeofencingAsync` if you want to stop geofencing all regions'\n );\n }\n for (const region of regions) {\n if (typeof region.latitude !== 'number') {\n throw new TypeError(`Region's latitude must be a number. Got '${region.latitude}' instead.`);\n }\n if (typeof region.longitude !== 'number') {\n throw new TypeError(\n `Region's longitude must be a number. Got '${region.longitude}' instead.`\n );\n }\n if (typeof region.radius !== 'number') {\n throw new TypeError(`Region's radius must be a number. Got '${region.radius}' instead.`);\n }\n }\n}\n\n// @needsAudit\n/**\n * Starts geofencing for given regions. When the new event comes, the task with specified name will\n * be called with the region that the device enter to or exit from.\n * If you want to add or remove regions from already running geofencing task, you can just call\n * `startGeofencingAsync` again with the new array of regions.\n *\n * # Task parameters\n *\n * Geofencing task will be receiving following data:\n * - `eventType` - Indicates the reason for calling the task, which can be triggered by entering or exiting the region.\n * See [GeofencingEventType](#geofencingeventtype).\n * - `region` - Object containing details about updated region. See [LocationRegion](#locationregion) for more details.\n *\n * @param taskName Name of the task that will be called when the device enters or exits from specified regions.\n * @param regions Array of region objects to be geofenced.\n *\n * @return A promise resolving as soon as the task is registered.\n *\n * @example\n * ```ts\n * import { GeofencingEventType } from 'expo-location';\n * import * as TaskManager from 'expo-task-manager';\n *\n * TaskManager.defineTask(YOUR_TASK_NAME, ({ data: { eventType, region }, error }) => {\n * if (error) {\n * // check `error.message` for more details.\n * return;\n * }\n * if (eventType === GeofencingEventType.Enter) {\n * console.log(\"You've entered region:\", region);\n * } else if (eventType === GeofencingEventType.Exit) {\n * console.log(\"You've left region:\", region);\n * }\n * });\n * ```\n */\nexport async function startGeofencingAsync(\n taskName: string,\n regions: LocationRegion[] = []\n): Promise<void> {\n _validateTaskName(taskName);\n _validateRegions(regions);\n await ExpoLocation.startGeofencingAsync(taskName, { regions });\n}\n\n// @needsAudit\n/**\n * Stops geofencing for specified task. It unregisters the background task so the app will not be\n * receiving any updates, especially in the background.\n * @param taskName Name of the task to unregister.\n * @return A promise resolving as soon as the task is unregistered.\n */\nexport async function stopGeofencingAsync(taskName: string): Promise<void> {\n _validateTaskName(taskName);\n await ExpoLocation.stopGeofencingAsync(taskName);\n}\n\n// @needsAudit\n/**\n * @param taskName Name of the geofencing task to check.\n * @return A promise which fulfills with boolean value indicating whether the geofencing task is\n * started or not.\n */\nexport async function hasStartedGeofencingAsync(taskName: string): Promise<boolean> {\n _validateTaskName(taskName);\n return ExpoLocation.hasStartedGeofencingAsync(taskName);\n}\n\nexport { LocationEventEmitter as EventEmitter, _getCurrentWatchId };\n\nexport {\n LocationAccuracy as Accuracy,\n LocationActivityType as ActivityType,\n LocationGeofencingEventType as GeofencingEventType,\n LocationGeofencingRegionState as GeofencingRegionState,\n PermissionStatus,\n PermissionHookOptions,\n setGoogleApiKey,\n};\n\nexport { installWebGeolocationPolyfill } from './GeolocationPolyfill';\nexport * from './Location.types';\n"]}
|
|
@@ -93,7 +93,7 @@ export declare enum LocationGeofencingRegionState {
|
|
|
93
93
|
*/
|
|
94
94
|
export type LocationOptions = {
|
|
95
95
|
/**
|
|
96
|
-
* Location manager accuracy. Pass one of `
|
|
96
|
+
* Location manager accuracy. Pass one of `Accuracy` enum values.
|
|
97
97
|
* For low-accuracies the implementation can avoid geolocation providers
|
|
98
98
|
* that consume a significant amount of power (such as GPS).
|
|
99
99
|
*/
|
|
@@ -159,7 +159,7 @@ export type LocationTaskOptions = LocationOptions & {
|
|
|
159
159
|
/**
|
|
160
160
|
* The type of user activity associated with the location updates.
|
|
161
161
|
* @see See [Apple docs](https://developer.apple.com/documentation/corelocation/cllocationmanager/1620567-activitytype) for more details.
|
|
162
|
-
* @default
|
|
162
|
+
* @default ActivityType.Other
|
|
163
163
|
* @platform ios
|
|
164
164
|
*/
|
|
165
165
|
activityType?: LocationActivityType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.types.js","sourceRoot":"","sources":["../src/Location.types.ts"],"names":[],"mappings":"AAEA,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,gBAyBX;AAzBD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,2DAAU,CAAA;IACV;;OAEG;IACH,qDAAO,CAAA;IACP;;OAEG;IACH,+DAAY,CAAA;IACZ;;OAEG;IACH,uDAAQ,CAAA;IACR;;OAEG;IACH,6DAAW,CAAA;IACX;;OAEG;IACH,iFAAqB,CAAA;AACvB,CAAC,EAzBW,gBAAgB,KAAhB,gBAAgB,QAyB3B;AAED,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,oBA0BX;AA1BD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,iEAAS,CAAA;IACT;;;OAGG;IACH,+FAAwB,CAAA;IACxB;;;OAGG;IACH,qEAAW,CAAA;IACX;;;OAGG;IACH,qFAAmB,CAAA;IACnB;;;;OAIG;IACH,uEAAY,CAAA;AACd,CAAC,EA1BW,oBAAoB,KAApB,oBAAoB,QA0B/B;AAED,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,2BASX;AATD,WAAY,2BAA2B;IACrC;;OAEG;IACH,+EAAS,CAAA;IACT;;OAEG;IACH,6EAAQ,CAAA;AACV,CAAC,EATW,2BAA2B,KAA3B,2BAA2B,QAStC;AAED,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,6BAaX;AAbD,WAAY,6BAA6B;IACvC;;OAEG;IACH,uFAAW,CAAA;IACX;;OAEG;IACH,qFAAU,CAAA;IACV;;OAEG;IACH,uFAAW,CAAA;AACb,CAAC,EAbW,6BAA6B,KAA7B,6BAA6B,QAaxC","sourcesContent":["import { PermissionResponse } from 'expo-modules-core';\n\n// @needsAudit\n/**\n * Enum with available location accuracies.\n */\nexport enum LocationAccuracy {\n /**\n * Accurate to the nearest three kilometers.\n */\n Lowest = 1,\n /**\n * Accurate to the nearest kilometer.\n */\n Low = 2,\n /**\n * Accurate to within one hundred meters.\n */\n Balanced = 3,\n /**\n * Accurate to within ten meters of the desired target.\n */\n High = 4,\n /**\n * The best level of accuracy available.\n */\n Highest = 5,\n /**\n * The highest possible accuracy that uses additional sensor data to facilitate navigation apps.\n */\n BestForNavigation = 6,\n}\n\n// @needsAudit\n/**\n * Enum with available activity types of background location tracking.\n */\nexport enum LocationActivityType {\n /**\n * Default activity type. Use it if there is no other type that matches the activity you track.\n */\n Other = 1,\n /**\n * Location updates are being used specifically during vehicular navigation to track location\n * changes to the automobile.\n */\n AutomotiveNavigation = 2,\n /**\n * Use this activity type if you track fitness activities such as walking, running, cycling,\n * and so on.\n */\n Fitness = 3,\n /**\n * Activity type for movements for other types of vehicular navigation that are not automobile\n * related.\n */\n OtherNavigation = 4,\n /**\n * Intended for airborne activities. Fall backs to `ActivityType.Other` if\n * unsupported.\n * @platform ios 12+\n */\n Airborne = 5,\n}\n\n// @needsAudit\n/**\n * A type of the event that geofencing task can receive.\n */\nexport enum LocationGeofencingEventType {\n /**\n * Emitted when the device entered observed region.\n */\n Enter = 1,\n /**\n * Occurs as soon as the device left observed region\n */\n Exit = 2,\n}\n\n// @needsAudit\n/**\n * State of the geofencing region that you receive through the geofencing task.\n */\nexport enum LocationGeofencingRegionState {\n /**\n * Indicates that the device position related to the region is unknown.\n */\n Unknown = 0,\n /**\n * Indicates that the device is inside the region.\n */\n Inside = 1,\n /**\n * Inverse of inside state.\n */\n Outside = 2,\n}\n\n// @needsAudit\n/**\n * Type representing options argument in `getCurrentPositionAsync`.\n */\nexport type LocationOptions = {\n /**\n * Location manager accuracy. Pass one of `LocationAccuracy` enum values.\n * For low-accuracies the implementation can avoid geolocation providers\n * that consume a significant amount of power (such as GPS).\n */\n accuracy?: LocationAccuracy;\n /**\n * Specifies whether to ask the user to turn on improved accuracy location mode\n * which uses Wi-Fi, cell networks and GPS sensor.\n * @default true\n * @platform android\n */\n mayShowUserSettingsDialog?: boolean;\n /**\n * Minimum time to wait between each update in milliseconds.\n * Default value may depend on `accuracy` option.\n * @platform android\n */\n timeInterval?: number;\n /**\n * Receive updates only when the location has changed by at least this distance in meters.\n * Default value may depend on `accuracy` option.\n */\n distanceInterval?: number;\n};\n\n// @needsAudit\n/**\n * Type representing options object that can be passed to `getLastKnownPositionAsync`.\n */\nexport type LocationLastKnownOptions = {\n /**\n * A number of milliseconds after which the last known location starts to be invalid and thus\n * `null` is returned.\n */\n maxAge?: number;\n /**\n * The maximum radius of uncertainty for the location, measured in meters. If the last known\n * location's accuracy radius is bigger (less accurate) then `null` is returned.\n */\n requiredAccuracy?: number;\n};\n\n// @needsAudit\n/**\n * Type representing background location task options.\n */\nexport type LocationTaskOptions = LocationOptions & {\n /**\n * A boolean indicating whether the status bar changes its appearance when\n * location services are used in the background.\n * @default false\n * @platform ios 11+\n */\n showsBackgroundLocationIndicator?: boolean;\n /**\n * The distance in meters that must occur between last reported location and the current location\n * before deferred locations are reported.\n * @default 0\n */\n deferredUpdatesDistance?: number;\n // @docsMissing\n deferredUpdatesTimeout?: number;\n /**\n * Minimum time interval in milliseconds that must pass since last reported location before all\n * later locations are reported in a batched update\n * @default 0\n */\n deferredUpdatesInterval?: number;\n /**\n * The type of user activity associated with the location updates.\n * @see See [Apple docs](https://developer.apple.com/documentation/corelocation/cllocationmanager/1620567-activitytype) for more details.\n * @default LocationActivityType.Other\n * @platform ios\n */\n activityType?: LocationActivityType;\n /**\n * A boolean value indicating whether the location manager can pause location\n * updates to improve battery life without sacrificing location data. When this option is set to\n * `true`, the location manager pauses updates (and powers down the appropriate hardware) at times\n * when the location data is unlikely to change. You can help the determination of when to pause\n * location updates by assigning a value to the `activityType` property.\n * @default false\n * @platform ios\n */\n pausesUpdatesAutomatically?: boolean;\n foregroundService?: LocationTaskServiceOptions;\n};\n\n// @needsAudit\nexport type LocationTaskServiceOptions = {\n /**\n * Title of the foreground service notification.\n */\n notificationTitle: string;\n /**\n * Subtitle of the foreground service notification.\n */\n notificationBody: string;\n /**\n * Color of the foreground service notification. Accepts `#RRGGBB` and `#AARRGGBB` hex formats.\n */\n notificationColor?: string;\n /**\n * Boolean value whether to destroy the foreground service if the app is killed.\n */\n killServiceOnDestroy?: boolean;\n};\n\n// @needsAudit\n/**\n * Type representing geofencing region object.\n */\nexport type LocationRegion = {\n /**\n * The identifier of the region object. Defaults to auto-generated UUID hash.\n */\n identifier?: string;\n /**\n * The latitude in degrees of region's center point.\n */\n latitude: number;\n /**\n * The longitude in degrees of region's center point.\n */\n longitude: number;\n /**\n * The radius measured in meters that defines the region's outer boundary.\n */\n radius: number;\n /**\n * Boolean value whether to call the task if the device enters the region.\n * @default true\n */\n notifyOnEnter?: boolean;\n /**\n * Boolean value whether to call the task if the device exits the region.\n * @default true\n */\n notifyOnExit?: boolean;\n /**\n * One of [GeofencingRegionState](#geofencingregionstate) region state. Determines whether the\n * device is inside or outside a region.\n */\n state?: LocationGeofencingRegionState;\n};\n\n// @needsAudit\n/**\n * Type representing the location object.\n */\nexport type LocationObject = {\n /**\n * The coordinates of the position.\n */\n coords: LocationObjectCoords;\n /**\n * The time at which this position information was obtained, in milliseconds since epoch.\n */\n timestamp: number;\n /**\n * Whether the location coordinates is mocked or not.\n * @platform android\n */\n mocked?: boolean;\n};\n\n// @needsAudit\n/**\n * Type representing the location GPS related data.\n */\nexport type LocationObjectCoords = {\n /**\n * The latitude in degrees.\n */\n latitude: number;\n /**\n * The longitude in degrees.\n */\n longitude: number;\n /**\n * The altitude in meters above the WGS 84 reference ellipsoid. Can be `null` on Web if it's not available.\n */\n altitude: number | null;\n /**\n * The radius of uncertainty for the location, measured in meters. Can be `null` on Web if it's not available.\n */\n accuracy: number | null;\n /**\n * The accuracy of the altitude value, in meters. Can be `null` on Web if it's not available.\n */\n altitudeAccuracy: number | null;\n /**\n * Horizontal direction of travel of this device, measured in degrees starting at due north and\n * continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is\n * 180 degrees, and so on. Can be `null` on Web if it's not available.\n */\n heading: number | null;\n /**\n * The instantaneous speed of the device in meters per second. Can be `null` on Web if it's not available.\n */\n speed: number | null;\n};\n\n// @needsAudit\n/**\n * Represents `watchPositionAsync` callback.\n */\nexport type LocationCallback = (location: LocationObject) => any;\n\n// @needsAudit\n/**\n * Represents the object containing details about location provider.\n */\nexport type LocationProviderStatus = {\n /**\n * Whether location services are enabled. See [Location.hasServicesEnabledAsync](#locationhasservicesenabledasync)\n * for a more convenient solution to get this value.\n */\n locationServicesEnabled: boolean;\n // @docsMissing\n backgroundModeEnabled: boolean;\n /**\n * Whether the GPS provider is available. If `true` the location data will come\n * from GPS, especially for requests with high accuracy.\n * @platform android\n */\n gpsAvailable?: boolean;\n /**\n * Whether the network provider is available. If `true` the location data will\n * come from cellular network, especially for requests with low accuracy.\n * @platform android\n */\n networkAvailable?: boolean;\n /**\n * Whether the passive provider is available. If `true` the location data will\n * be determined passively.\n * @platform android\n */\n passiveAvailable?: boolean;\n};\n\n// @needsAudit\n/**\n * Type of the object containing heading details and provided by `watchHeadingAsync` callback.\n */\nexport type LocationHeadingObject = {\n /**\n * Measure of true north in degrees (needs location permissions, will return `-1` if not given).\n */\n trueHeading: number;\n /**\n * Measure of magnetic north in degrees.\n */\n magHeading: number;\n /**\n * Level of calibration of compass.\n * - `3`: high accuracy, `2`: medium accuracy, `1`: low accuracy, `0`: none\n * Reference for iOS:\n * - `3`: < 20 degrees uncertainty, `2`: < 35 degrees, `1`: < 50 degrees, `0`: > 50 degrees\n */\n accuracy: number;\n};\n\n// @needsAudit\n/**\n * Represents `watchHeadingAsync` callback.\n */\nexport type LocationHeadingCallback = (location: LocationHeadingObject) => any;\n\n// @needsAudit\n/**\n * An object of options for forward and reverse geocoding.\n */\nexport type LocationGeocodingOptions = {\n /**\n * Whether to force using Google Maps API instead of the native implementation.\n * Used by default only on Web platform. Requires providing an API key by `setGoogleApiKey`.\n */\n useGoogleMaps?: boolean;\n};\n\n// @needsAudit\n/**\n * Type representing a result of `geocodeAsync`.\n */\nexport type LocationGeocodedLocation = {\n /**\n * The latitude in degrees.\n */\n latitude: number;\n /**\n * The longitude in degrees.\n */\n longitude: number;\n /**\n * The altitude in meters above the WGS 84 reference ellipsoid.\n */\n altitude?: number;\n /**\n * The radius of uncertainty for the location, measured in meters.\n */\n accuracy?: number;\n};\n\n// @needsAudit\n/**\n * Type representing a result of `reverseGeocodeAsync`.\n */\nexport type LocationGeocodedAddress = {\n /**\n * City name of the address.\n */\n city: string | null;\n /**\n * Additional city-level information like district name.\n */\n district: string | null;\n /**\n * Street number of the address.\n */\n streetNumber: string | null;\n /**\n * Street name of the address.\n */\n street: string | null;\n /**\n * The state or province associated with the address.\n */\n region: string | null;\n /**\n * Additional information about administrative area.\n */\n subregion: string | null;\n /**\n * Localized country name of the address.\n */\n country: string | null;\n /**\n * Postal code of the address.\n */\n postalCode: string | null;\n /**\n * The name of the placemark, for example, \"Tower Bridge\".\n */\n name: string | null;\n /**\n * Localized (ISO) country code of the address, if available.\n */\n isoCountryCode: string | null;\n /**\n * The timezone identifier associated with the address.\n * @platform ios\n */\n timezone: string | null;\n};\n\n// @needsAudit\n/**\n * Represents subscription object returned by methods watching for new locations or headings.\n */\nexport type LocationSubscription = {\n /**\n * Call this function with no arguments to remove this subscription. The callback will no longer\n * be called for location updates.\n */\n remove: () => void;\n};\n\n// @needsAudit\nexport type PermissionDetailsLocationIOS = {\n /**\n * The scope of granted permission. Indicates when it's possible to use location.\n */\n scope: 'whenInUse' | 'always' | 'none';\n};\n\n// @needsAudit\nexport type PermissionDetailsLocationAndroid = {\n /**\n * @deprecated Use `accuracy` field instead.\n */\n scope: 'fine' | 'coarse' | 'none';\n /**\n * Indicates the type of location provider.\n */\n accuracy: 'fine' | 'coarse' | 'none';\n};\n\n// @needsAudit\n/**\n * `LocationPermissionResponse` extends [PermissionResponse](#permissionresponse)\n * type exported by `expo-modules-core` and contains additional platform-specific fields.\n */\nexport type LocationPermissionResponse = PermissionResponse & {\n ios?: PermissionDetailsLocationIOS;\n android?: PermissionDetailsLocationAndroid;\n};\n\nexport type { PermissionResponse };\n"]}
|
|
1
|
+
{"version":3,"file":"Location.types.js","sourceRoot":"","sources":["../src/Location.types.ts"],"names":[],"mappings":"AAEA,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,gBAyBX;AAzBD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,2DAAU,CAAA;IACV;;OAEG;IACH,qDAAO,CAAA;IACP;;OAEG;IACH,+DAAY,CAAA;IACZ;;OAEG;IACH,uDAAQ,CAAA;IACR;;OAEG;IACH,6DAAW,CAAA;IACX;;OAEG;IACH,iFAAqB,CAAA;AACvB,CAAC,EAzBW,gBAAgB,KAAhB,gBAAgB,QAyB3B;AAED,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,oBA0BX;AA1BD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,iEAAS,CAAA;IACT;;;OAGG;IACH,+FAAwB,CAAA;IACxB;;;OAGG;IACH,qEAAW,CAAA;IACX;;;OAGG;IACH,qFAAmB,CAAA;IACnB;;;;OAIG;IACH,uEAAY,CAAA;AACd,CAAC,EA1BW,oBAAoB,KAApB,oBAAoB,QA0B/B;AAED,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,2BASX;AATD,WAAY,2BAA2B;IACrC;;OAEG;IACH,+EAAS,CAAA;IACT;;OAEG;IACH,6EAAQ,CAAA;AACV,CAAC,EATW,2BAA2B,KAA3B,2BAA2B,QAStC;AAED,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,6BAaX;AAbD,WAAY,6BAA6B;IACvC;;OAEG;IACH,uFAAW,CAAA;IACX;;OAEG;IACH,qFAAU,CAAA;IACV;;OAEG;IACH,uFAAW,CAAA;AACb,CAAC,EAbW,6BAA6B,KAA7B,6BAA6B,QAaxC","sourcesContent":["import { PermissionResponse } from 'expo-modules-core';\n\n// @needsAudit\n/**\n * Enum with available location accuracies.\n */\nexport enum LocationAccuracy {\n /**\n * Accurate to the nearest three kilometers.\n */\n Lowest = 1,\n /**\n * Accurate to the nearest kilometer.\n */\n Low = 2,\n /**\n * Accurate to within one hundred meters.\n */\n Balanced = 3,\n /**\n * Accurate to within ten meters of the desired target.\n */\n High = 4,\n /**\n * The best level of accuracy available.\n */\n Highest = 5,\n /**\n * The highest possible accuracy that uses additional sensor data to facilitate navigation apps.\n */\n BestForNavigation = 6,\n}\n\n// @needsAudit\n/**\n * Enum with available activity types of background location tracking.\n */\nexport enum LocationActivityType {\n /**\n * Default activity type. Use it if there is no other type that matches the activity you track.\n */\n Other = 1,\n /**\n * Location updates are being used specifically during vehicular navigation to track location\n * changes to the automobile.\n */\n AutomotiveNavigation = 2,\n /**\n * Use this activity type if you track fitness activities such as walking, running, cycling,\n * and so on.\n */\n Fitness = 3,\n /**\n * Activity type for movements for other types of vehicular navigation that are not automobile\n * related.\n */\n OtherNavigation = 4,\n /**\n * Intended for airborne activities. Fall backs to `ActivityType.Other` if\n * unsupported.\n * @platform ios 12+\n */\n Airborne = 5,\n}\n\n// @needsAudit\n/**\n * A type of the event that geofencing task can receive.\n */\nexport enum LocationGeofencingEventType {\n /**\n * Emitted when the device entered observed region.\n */\n Enter = 1,\n /**\n * Occurs as soon as the device left observed region\n */\n Exit = 2,\n}\n\n// @needsAudit\n/**\n * State of the geofencing region that you receive through the geofencing task.\n */\nexport enum LocationGeofencingRegionState {\n /**\n * Indicates that the device position related to the region is unknown.\n */\n Unknown = 0,\n /**\n * Indicates that the device is inside the region.\n */\n Inside = 1,\n /**\n * Inverse of inside state.\n */\n Outside = 2,\n}\n\n// @needsAudit\n/**\n * Type representing options argument in `getCurrentPositionAsync`.\n */\nexport type LocationOptions = {\n /**\n * Location manager accuracy. Pass one of `Accuracy` enum values.\n * For low-accuracies the implementation can avoid geolocation providers\n * that consume a significant amount of power (such as GPS).\n */\n accuracy?: LocationAccuracy;\n /**\n * Specifies whether to ask the user to turn on improved accuracy location mode\n * which uses Wi-Fi, cell networks and GPS sensor.\n * @default true\n * @platform android\n */\n mayShowUserSettingsDialog?: boolean;\n /**\n * Minimum time to wait between each update in milliseconds.\n * Default value may depend on `accuracy` option.\n * @platform android\n */\n timeInterval?: number;\n /**\n * Receive updates only when the location has changed by at least this distance in meters.\n * Default value may depend on `accuracy` option.\n */\n distanceInterval?: number;\n};\n\n// @needsAudit\n/**\n * Type representing options object that can be passed to `getLastKnownPositionAsync`.\n */\nexport type LocationLastKnownOptions = {\n /**\n * A number of milliseconds after which the last known location starts to be invalid and thus\n * `null` is returned.\n */\n maxAge?: number;\n /**\n * The maximum radius of uncertainty for the location, measured in meters. If the last known\n * location's accuracy radius is bigger (less accurate) then `null` is returned.\n */\n requiredAccuracy?: number;\n};\n\n// @needsAudit\n/**\n * Type representing background location task options.\n */\nexport type LocationTaskOptions = LocationOptions & {\n /**\n * A boolean indicating whether the status bar changes its appearance when\n * location services are used in the background.\n * @default false\n * @platform ios 11+\n */\n showsBackgroundLocationIndicator?: boolean;\n /**\n * The distance in meters that must occur between last reported location and the current location\n * before deferred locations are reported.\n * @default 0\n */\n deferredUpdatesDistance?: number;\n // @docsMissing\n deferredUpdatesTimeout?: number;\n /**\n * Minimum time interval in milliseconds that must pass since last reported location before all\n * later locations are reported in a batched update\n * @default 0\n */\n deferredUpdatesInterval?: number;\n /**\n * The type of user activity associated with the location updates.\n * @see See [Apple docs](https://developer.apple.com/documentation/corelocation/cllocationmanager/1620567-activitytype) for more details.\n * @default ActivityType.Other\n * @platform ios\n */\n activityType?: LocationActivityType;\n /**\n * A boolean value indicating whether the location manager can pause location\n * updates to improve battery life without sacrificing location data. When this option is set to\n * `true`, the location manager pauses updates (and powers down the appropriate hardware) at times\n * when the location data is unlikely to change. You can help the determination of when to pause\n * location updates by assigning a value to the `activityType` property.\n * @default false\n * @platform ios\n */\n pausesUpdatesAutomatically?: boolean;\n foregroundService?: LocationTaskServiceOptions;\n};\n\n// @needsAudit\nexport type LocationTaskServiceOptions = {\n /**\n * Title of the foreground service notification.\n */\n notificationTitle: string;\n /**\n * Subtitle of the foreground service notification.\n */\n notificationBody: string;\n /**\n * Color of the foreground service notification. Accepts `#RRGGBB` and `#AARRGGBB` hex formats.\n */\n notificationColor?: string;\n /**\n * Boolean value whether to destroy the foreground service if the app is killed.\n */\n killServiceOnDestroy?: boolean;\n};\n\n// @needsAudit\n/**\n * Type representing geofencing region object.\n */\nexport type LocationRegion = {\n /**\n * The identifier of the region object. Defaults to auto-generated UUID hash.\n */\n identifier?: string;\n /**\n * The latitude in degrees of region's center point.\n */\n latitude: number;\n /**\n * The longitude in degrees of region's center point.\n */\n longitude: number;\n /**\n * The radius measured in meters that defines the region's outer boundary.\n */\n radius: number;\n /**\n * Boolean value whether to call the task if the device enters the region.\n * @default true\n */\n notifyOnEnter?: boolean;\n /**\n * Boolean value whether to call the task if the device exits the region.\n * @default true\n */\n notifyOnExit?: boolean;\n /**\n * One of [GeofencingRegionState](#geofencingregionstate) region state. Determines whether the\n * device is inside or outside a region.\n */\n state?: LocationGeofencingRegionState;\n};\n\n// @needsAudit\n/**\n * Type representing the location object.\n */\nexport type LocationObject = {\n /**\n * The coordinates of the position.\n */\n coords: LocationObjectCoords;\n /**\n * The time at which this position information was obtained, in milliseconds since epoch.\n */\n timestamp: number;\n /**\n * Whether the location coordinates is mocked or not.\n * @platform android\n */\n mocked?: boolean;\n};\n\n// @needsAudit\n/**\n * Type representing the location GPS related data.\n */\nexport type LocationObjectCoords = {\n /**\n * The latitude in degrees.\n */\n latitude: number;\n /**\n * The longitude in degrees.\n */\n longitude: number;\n /**\n * The altitude in meters above the WGS 84 reference ellipsoid. Can be `null` on Web if it's not available.\n */\n altitude: number | null;\n /**\n * The radius of uncertainty for the location, measured in meters. Can be `null` on Web if it's not available.\n */\n accuracy: number | null;\n /**\n * The accuracy of the altitude value, in meters. Can be `null` on Web if it's not available.\n */\n altitudeAccuracy: number | null;\n /**\n * Horizontal direction of travel of this device, measured in degrees starting at due north and\n * continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is\n * 180 degrees, and so on. Can be `null` on Web if it's not available.\n */\n heading: number | null;\n /**\n * The instantaneous speed of the device in meters per second. Can be `null` on Web if it's not available.\n */\n speed: number | null;\n};\n\n// @needsAudit\n/**\n * Represents `watchPositionAsync` callback.\n */\nexport type LocationCallback = (location: LocationObject) => any;\n\n// @needsAudit\n/**\n * Represents the object containing details about location provider.\n */\nexport type LocationProviderStatus = {\n /**\n * Whether location services are enabled. See [Location.hasServicesEnabledAsync](#locationhasservicesenabledasync)\n * for a more convenient solution to get this value.\n */\n locationServicesEnabled: boolean;\n // @docsMissing\n backgroundModeEnabled: boolean;\n /**\n * Whether the GPS provider is available. If `true` the location data will come\n * from GPS, especially for requests with high accuracy.\n * @platform android\n */\n gpsAvailable?: boolean;\n /**\n * Whether the network provider is available. If `true` the location data will\n * come from cellular network, especially for requests with low accuracy.\n * @platform android\n */\n networkAvailable?: boolean;\n /**\n * Whether the passive provider is available. If `true` the location data will\n * be determined passively.\n * @platform android\n */\n passiveAvailable?: boolean;\n};\n\n// @needsAudit\n/**\n * Type of the object containing heading details and provided by `watchHeadingAsync` callback.\n */\nexport type LocationHeadingObject = {\n /**\n * Measure of true north in degrees (needs location permissions, will return `-1` if not given).\n */\n trueHeading: number;\n /**\n * Measure of magnetic north in degrees.\n */\n magHeading: number;\n /**\n * Level of calibration of compass.\n * - `3`: high accuracy, `2`: medium accuracy, `1`: low accuracy, `0`: none\n * Reference for iOS:\n * - `3`: < 20 degrees uncertainty, `2`: < 35 degrees, `1`: < 50 degrees, `0`: > 50 degrees\n */\n accuracy: number;\n};\n\n// @needsAudit\n/**\n * Represents `watchHeadingAsync` callback.\n */\nexport type LocationHeadingCallback = (location: LocationHeadingObject) => any;\n\n// @needsAudit\n/**\n * An object of options for forward and reverse geocoding.\n */\nexport type LocationGeocodingOptions = {\n /**\n * Whether to force using Google Maps API instead of the native implementation.\n * Used by default only on Web platform. Requires providing an API key by `setGoogleApiKey`.\n */\n useGoogleMaps?: boolean;\n};\n\n// @needsAudit\n/**\n * Type representing a result of `geocodeAsync`.\n */\nexport type LocationGeocodedLocation = {\n /**\n * The latitude in degrees.\n */\n latitude: number;\n /**\n * The longitude in degrees.\n */\n longitude: number;\n /**\n * The altitude in meters above the WGS 84 reference ellipsoid.\n */\n altitude?: number;\n /**\n * The radius of uncertainty for the location, measured in meters.\n */\n accuracy?: number;\n};\n\n// @needsAudit\n/**\n * Type representing a result of `reverseGeocodeAsync`.\n */\nexport type LocationGeocodedAddress = {\n /**\n * City name of the address.\n */\n city: string | null;\n /**\n * Additional city-level information like district name.\n */\n district: string | null;\n /**\n * Street number of the address.\n */\n streetNumber: string | null;\n /**\n * Street name of the address.\n */\n street: string | null;\n /**\n * The state or province associated with the address.\n */\n region: string | null;\n /**\n * Additional information about administrative area.\n */\n subregion: string | null;\n /**\n * Localized country name of the address.\n */\n country: string | null;\n /**\n * Postal code of the address.\n */\n postalCode: string | null;\n /**\n * The name of the placemark, for example, \"Tower Bridge\".\n */\n name: string | null;\n /**\n * Localized (ISO) country code of the address, if available.\n */\n isoCountryCode: string | null;\n /**\n * The timezone identifier associated with the address.\n * @platform ios\n */\n timezone: string | null;\n};\n\n// @needsAudit\n/**\n * Represents subscription object returned by methods watching for new locations or headings.\n */\nexport type LocationSubscription = {\n /**\n * Call this function with no arguments to remove this subscription. The callback will no longer\n * be called for location updates.\n */\n remove: () => void;\n};\n\n// @needsAudit\nexport type PermissionDetailsLocationIOS = {\n /**\n * The scope of granted permission. Indicates when it's possible to use location.\n */\n scope: 'whenInUse' | 'always' | 'none';\n};\n\n// @needsAudit\nexport type PermissionDetailsLocationAndroid = {\n /**\n * @deprecated Use `accuracy` field instead.\n */\n scope: 'fine' | 'coarse' | 'none';\n /**\n * Indicates the type of location provider.\n */\n accuracy: 'fine' | 'coarse' | 'none';\n};\n\n// @needsAudit\n/**\n * `LocationPermissionResponse` extends [PermissionResponse](#permissionresponse)\n * type exported by `expo-modules-core` and contains additional platform-specific fields.\n */\nexport type LocationPermissionResponse = PermissionResponse & {\n ios?: PermissionDetailsLocationIOS;\n android?: PermissionDetailsLocationAndroid;\n};\n\nexport type { PermissionResponse };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-location",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"description": "Allows reading geolocation information from the device. Your app can poll for the current location or subscribe to location update events.",
|
|
5
5
|
"main": "build/Location.js",
|
|
6
6
|
"types": "build/Location.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"expo": "*"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
|
|
48
48
|
}
|
package/src/Location.ts
CHANGED
|
@@ -301,7 +301,7 @@ export async function requestBackgroundPermissionsAsync(): Promise<PermissionRes
|
|
|
301
301
|
|
|
302
302
|
// @needsAudit
|
|
303
303
|
/**
|
|
304
|
-
* Check or request permissions for the
|
|
304
|
+
* Check or request permissions for the background location.
|
|
305
305
|
* This uses both `requestBackgroundPermissionsAsync` and `getBackgroundPermissionsAsync` to
|
|
306
306
|
* interact with the permissions.
|
|
307
307
|
*
|
package/src/Location.types.ts
CHANGED
|
@@ -103,7 +103,7 @@ export enum LocationGeofencingRegionState {
|
|
|
103
103
|
*/
|
|
104
104
|
export type LocationOptions = {
|
|
105
105
|
/**
|
|
106
|
-
* Location manager accuracy. Pass one of `
|
|
106
|
+
* Location manager accuracy. Pass one of `Accuracy` enum values.
|
|
107
107
|
* For low-accuracies the implementation can avoid geolocation providers
|
|
108
108
|
* that consume a significant amount of power (such as GPS).
|
|
109
109
|
*/
|
|
@@ -174,7 +174,7 @@ export type LocationTaskOptions = LocationOptions & {
|
|
|
174
174
|
/**
|
|
175
175
|
* The type of user activity associated with the location updates.
|
|
176
176
|
* @see See [Apple docs](https://developer.apple.com/documentation/corelocation/cllocationmanager/1620567-activitytype) for more details.
|
|
177
|
-
* @default
|
|
177
|
+
* @default ActivityType.Other
|
|
178
178
|
* @platform ios
|
|
179
179
|
*/
|
|
180
180
|
activityType?: LocationActivityType;
|