expo-location 14.2.2 → 14.3.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 +1 -1
- package/android/build.gradle +2 -2
- package/build/Location.d.ts +11 -7
- package/build/Location.d.ts.map +1 -1
- package/build/Location.js +11 -7
- package/build/Location.js.map +1 -1
- package/ios/EXLocation.xcframework/ios-arm64/EXLocation.framework/EXLocation +0 -0
- package/ios/EXLocation.xcframework/ios-arm64/EXLocation.framework/Info.plist +0 -0
- package/ios/EXLocation.xcframework/ios-arm64_x86_64-simulator/EXLocation.framework/EXLocation +0 -0
- package/ios/EXLocation.xcframework/ios-arm64_x86_64-simulator/EXLocation.framework/Info.plist +0 -0
- package/package.json +3 -3
- package/src/Location.ts +11 -7
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
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 = '14.
|
|
6
|
+
version = '14.3.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", 31)
|
|
76
76
|
versionCode 29
|
|
77
|
-
versionName "14.
|
|
77
|
+
versionName "14.3.0"
|
|
78
78
|
}
|
|
79
79
|
lintOptions {
|
|
80
80
|
abortOnError false
|
package/build/Location.d.ts
CHANGED
|
@@ -154,9 +154,6 @@ export declare function hasServicesEnabledAsync(): Promise<boolean>;
|
|
|
154
154
|
export declare function isBackgroundLocationAvailableAsync(): Promise<boolean>;
|
|
155
155
|
/**
|
|
156
156
|
* Registers for receiving location updates that can also come when the app is in the background.
|
|
157
|
-
* @param taskName Name of the task receiving location updates.
|
|
158
|
-
* @param options An object of options passed to the location manager.
|
|
159
|
-
* @return A promise resolving once the task with location updates is registered.
|
|
160
157
|
*
|
|
161
158
|
* # Task parameters
|
|
162
159
|
*
|
|
@@ -174,6 +171,11 @@ export declare function isBackgroundLocationAvailableAsync(): Promise<boolean>;
|
|
|
174
171
|
* console.log('Received new locations', locations);
|
|
175
172
|
* });
|
|
176
173
|
* ```
|
|
174
|
+
*
|
|
175
|
+
* @param taskName Name of the task receiving location updates.
|
|
176
|
+
* @param options An object of options passed to the location manager.
|
|
177
|
+
*
|
|
178
|
+
* @return A promise resolving once the task with location updates is registered.
|
|
177
179
|
*/
|
|
178
180
|
export declare function startLocationUpdatesAsync(taskName: string, options?: LocationTaskOptions): Promise<void>;
|
|
179
181
|
/**
|
|
@@ -193,9 +195,6 @@ export declare function hasStartedLocationUpdatesAsync(taskName: string): Promis
|
|
|
193
195
|
* be called with the region that the device enter to or exit from.
|
|
194
196
|
* If you want to add or remove regions from already running geofencing task, you can just call
|
|
195
197
|
* `startGeofencingAsync` again with the new array of regions.
|
|
196
|
-
* @param taskName Name of the task that will be called when the device enters or exits from specified regions.
|
|
197
|
-
* @param regions Array of region objects to be geofenced.
|
|
198
|
-
* @return A promise resolving as soon as the task is registered.
|
|
199
198
|
*
|
|
200
199
|
* # Task parameters
|
|
201
200
|
*
|
|
@@ -204,7 +203,12 @@ export declare function hasStartedLocationUpdatesAsync(taskName: string): Promis
|
|
|
204
203
|
* See [GeofencingEventType](#geofencingeventtype).
|
|
205
204
|
* - `region` - Object containing details about updated region. See [LocationRegion](#locationregion) for more details.
|
|
206
205
|
*
|
|
207
|
-
*
|
|
206
|
+
* @param taskName Name of the task that will be called when the device enters or exits from specified regions.
|
|
207
|
+
* @param regions Array of region objects to be geofenced.
|
|
208
|
+
*
|
|
209
|
+
* @return A promise resolving as soon as the task is registered.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
208
212
|
* ```ts
|
|
209
213
|
* import { GeofencingEventType } from 'expo-location';
|
|
210
214
|
* import * as TaskManager from 'expo-task-manager';
|
package/build/Location.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../src/Location.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EAGtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAyC,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGlG;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAE9E;AAGD;;;;GAIG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAShE;AAGD;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAEzB;AAGD;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAEhC;AAGD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,gBAAgB,GACzB,O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7C,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,mBAA6D,GACrE,OAAO,CAAC,IAAI,CAAC,CAGf;AAGD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E;AAGD;;;;GAIG;AACH,wBAAsB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGvF;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAc,EAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CAIf;AAGD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE;AAGD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGlF;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,EAChB,qBAAqB,EACrB,eAAe,GAChB,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,cAAc,kBAAkB,CAAC"}
|
package/build/Location.js
CHANGED
|
@@ -266,9 +266,6 @@ export async function isBackgroundLocationAvailableAsync() {
|
|
|
266
266
|
// @needsAudit
|
|
267
267
|
/**
|
|
268
268
|
* Registers for receiving location updates that can also come when the app is in the background.
|
|
269
|
-
* @param taskName Name of the task receiving location updates.
|
|
270
|
-
* @param options An object of options passed to the location manager.
|
|
271
|
-
* @return A promise resolving once the task with location updates is registered.
|
|
272
269
|
*
|
|
273
270
|
* # Task parameters
|
|
274
271
|
*
|
|
@@ -286,6 +283,11 @@ export async function isBackgroundLocationAvailableAsync() {
|
|
|
286
283
|
* console.log('Received new locations', locations);
|
|
287
284
|
* });
|
|
288
285
|
* ```
|
|
286
|
+
*
|
|
287
|
+
* @param taskName Name of the task receiving location updates.
|
|
288
|
+
* @param options An object of options passed to the location manager.
|
|
289
|
+
*
|
|
290
|
+
* @return A promise resolving once the task with location updates is registered.
|
|
289
291
|
*/
|
|
290
292
|
export async function startLocationUpdatesAsync(taskName, options = { accuracy: LocationAccuracy.Balanced }) {
|
|
291
293
|
_validateTaskName(taskName);
|
|
@@ -334,9 +336,6 @@ function _validateRegions(regions) {
|
|
|
334
336
|
* be called with the region that the device enter to or exit from.
|
|
335
337
|
* If you want to add or remove regions from already running geofencing task, you can just call
|
|
336
338
|
* `startGeofencingAsync` again with the new array of regions.
|
|
337
|
-
* @param taskName Name of the task that will be called when the device enters or exits from specified regions.
|
|
338
|
-
* @param regions Array of region objects to be geofenced.
|
|
339
|
-
* @return A promise resolving as soon as the task is registered.
|
|
340
339
|
*
|
|
341
340
|
* # Task parameters
|
|
342
341
|
*
|
|
@@ -345,7 +344,12 @@ function _validateRegions(regions) {
|
|
|
345
344
|
* See [GeofencingEventType](#geofencingeventtype).
|
|
346
345
|
* - `region` - Object containing details about updated region. See [LocationRegion](#locationregion) for more details.
|
|
347
346
|
*
|
|
348
|
-
*
|
|
347
|
+
* @param taskName Name of the task that will be called when the device enters or exits from specified regions.
|
|
348
|
+
* @param regions Array of region objects to be geofenced.
|
|
349
|
+
*
|
|
350
|
+
* @return A promise resolving as soon as the task is registered.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
349
353
|
* ```ts
|
|
350
354
|
* import { GeofencingEventType } from 'expo-location';
|
|
351
355
|
* import * as TaskManager from 'expo-task-manager';
|
package/build/Location.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.js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;;;;GAiCG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,UAA4B,EAAE;IAE9B,iBAAiB,CAAC,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 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 * @param taskName Name of the task receiving location updates.\n * @param options An object of options passed to the location manager.\n * @return A promise resolving once the task with location updates is registered.\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 */\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 * @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 * @return A promise resolving as soon as the task is registered.\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 * # 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,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;AACnC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElG,cAAc;AACd;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,OAAO,YAAY,CAAC,sBAAsB,EAAE,CAAC;AAC/C,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B;IAC9C,kFAAkF;IAClF,qGAAqG;IACrG,+GAA+G;IAC/G,wFAAwF;IAExF,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QAC7B,OAAO,YAAY,CAAC,0BAA0B,EAAE,CAAC;KAClD;AACH,CAAC;AAED,cAAc;AACd;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,UAA2B,EAAE;IAE7B,OAAO,YAAY,CAAC,uBAAuB,CAAC,OAAO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issionStatus,\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"]}
|
|
Binary file
|
|
Binary file
|
package/ios/EXLocation.xcframework/ios-arm64_x86_64-simulator/EXLocation.framework/EXLocation
CHANGED
|
Binary file
|
package/ios/EXLocation.xcframework/ios-arm64_x86_64-simulator/EXLocation.framework/Info.plist
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-location",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.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",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"expo-module-scripts": "^2.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@expo/config-plugins": "
|
|
45
|
+
"@expo/config-plugins": "~5.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"expo": "*"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
|
|
51
51
|
}
|
package/src/Location.ts
CHANGED
|
@@ -344,9 +344,6 @@ export async function isBackgroundLocationAvailableAsync(): Promise<boolean> {
|
|
|
344
344
|
// @needsAudit
|
|
345
345
|
/**
|
|
346
346
|
* Registers for receiving location updates that can also come when the app is in the background.
|
|
347
|
-
* @param taskName Name of the task receiving location updates.
|
|
348
|
-
* @param options An object of options passed to the location manager.
|
|
349
|
-
* @return A promise resolving once the task with location updates is registered.
|
|
350
347
|
*
|
|
351
348
|
* # Task parameters
|
|
352
349
|
*
|
|
@@ -364,6 +361,11 @@ export async function isBackgroundLocationAvailableAsync(): Promise<boolean> {
|
|
|
364
361
|
* console.log('Received new locations', locations);
|
|
365
362
|
* });
|
|
366
363
|
* ```
|
|
364
|
+
*
|
|
365
|
+
* @param taskName Name of the task receiving location updates.
|
|
366
|
+
* @param options An object of options passed to the location manager.
|
|
367
|
+
*
|
|
368
|
+
* @return A promise resolving once the task with location updates is registered.
|
|
367
369
|
*/
|
|
368
370
|
export async function startLocationUpdatesAsync(
|
|
369
371
|
taskName: string,
|
|
@@ -424,9 +426,6 @@ function _validateRegions(regions: LocationRegion[]) {
|
|
|
424
426
|
* be called with the region that the device enter to or exit from.
|
|
425
427
|
* If you want to add or remove regions from already running geofencing task, you can just call
|
|
426
428
|
* `startGeofencingAsync` again with the new array of regions.
|
|
427
|
-
* @param taskName Name of the task that will be called when the device enters or exits from specified regions.
|
|
428
|
-
* @param regions Array of region objects to be geofenced.
|
|
429
|
-
* @return A promise resolving as soon as the task is registered.
|
|
430
429
|
*
|
|
431
430
|
* # Task parameters
|
|
432
431
|
*
|
|
@@ -435,7 +434,12 @@ function _validateRegions(regions: LocationRegion[]) {
|
|
|
435
434
|
* See [GeofencingEventType](#geofencingeventtype).
|
|
436
435
|
* - `region` - Object containing details about updated region. See [LocationRegion](#locationregion) for more details.
|
|
437
436
|
*
|
|
438
|
-
*
|
|
437
|
+
* @param taskName Name of the task that will be called when the device enters or exits from specified regions.
|
|
438
|
+
* @param regions Array of region objects to be geofenced.
|
|
439
|
+
*
|
|
440
|
+
* @return A promise resolving as soon as the task is registered.
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
439
443
|
* ```ts
|
|
440
444
|
* import { GeofencingEventType } from 'expo-location';
|
|
441
445
|
* import * as TaskManager from 'expo-task-manager';
|
package/tsconfig.json
CHANGED