expo-location 18.0.10 → 18.0.11-canary-20250403-13261ac
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 +14 -19
- package/android/build.gradle +8 -11
- package/android/proguard-rules.pro +3 -0
- package/android/src/main/java/expo/modules/location/LocationHelpers.kt +12 -41
- package/android/src/main/java/expo/modules/location/LocationModule.kt +64 -28
- package/android/src/main/java/expo/modules/location/LocationParams.kt +14 -0
- package/build/LocationEventEmitter.web.d.ts +1 -1
- package/build/LocationEventEmitter.web.d.ts.map +1 -1
- package/expo-module.config.json +9 -16
- package/ios/LocationModule.swift +5 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.module +110 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.pom +47 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/18.0.11-canary-20250403-13261ac/expo.modules.location-18.0.11-canary-20250403-13261ac.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml +13 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.sha512 +1 -0
- package/package.json +4 -4
- package/android/libs/io.nlopez.smartlocation-3.3.3-jetified.aar +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,54 +8,49 @@
|
|
|
8
8
|
|
|
9
9
|
### 🐛 Bug fixes
|
|
10
10
|
|
|
11
|
-
### 💡 Others
|
|
12
|
-
|
|
13
|
-
## 18.0.10 — 2025-04-01
|
|
14
|
-
|
|
15
|
-
### 🐛 Bug fixes
|
|
16
|
-
|
|
17
11
|
- [iOS] Fixed issue with some permission request flows resolving too soon on iOS. ([#35693](https://github.com/expo/expo/pull/35693) by [@chrfalch](https://github.com/chrfalch))
|
|
18
12
|
- [iOS] Remove restarting all services when CLLocationManager reports an error ([#35478](https://github.com/expo/expo/pull/35478) by [@chrfalch](https://github.com/chrfalch))
|
|
13
|
+
- [Android] Add missing ProGuard rule to fix task consumer failed ([#34098](https://github.com/expo/expo/pull/34098) by [@cornejobarraza](https://github.com/cornejobarraza))
|
|
14
|
+
- [iOS] `startLocationUpdatesAsync` should not require background permissions ([#33617](https://github.com/expo/expo/pull/33617) by [@andrejpavlovic](https://github.com/andrejpavlovic)
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
### 💡 Others
|
|
17
|
+
|
|
18
|
+
- On Android, remove dependency on `smart-location-lib`. ([#33609](https://github.com/expo/expo/pull/33609) by [@alanjhughes](https://github.com/alanjhughes))
|
|
19
|
+
- [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
|
|
20
|
+
- [Android] Added missing dependency. ([#35822](https://github.com/expo/expo/pull/35822) by [@lukmccall](https://github.com/lukmccall))
|
|
21
|
+
|
|
22
|
+
## 18.0.9 - 2025-03-31
|
|
21
23
|
|
|
22
24
|
_This version does not introduce any user-facing changes._
|
|
23
25
|
|
|
24
|
-
## 18.0.8
|
|
26
|
+
## 18.0.8 - 2025-03-14
|
|
25
27
|
|
|
26
28
|
### 💡 Others
|
|
27
29
|
|
|
28
30
|
- On iOS, added setting the scope value as per our documentation. ([#35452](https://github.com/expo/expo/pull/35452) by [@chrfalch](https://github.com/chrfalch))
|
|
29
31
|
|
|
30
|
-
## 18.0.7 — 2025-02-19
|
|
31
|
-
|
|
32
|
-
- On Android, remove dependency on `smart-location-lib`. ([#33609](https://github.com/expo/expo/pull/33609) by [@alanjhughes](https://github.com/alanjhughes))
|
|
33
|
-
- [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
|
|
34
|
-
|
|
35
32
|
## 18.0.7 - 2025-02-19
|
|
36
33
|
|
|
37
|
-
- ([iOS][location] Add scope to foreground and background iOS permissions as pr. documentation (#35452))
|
|
38
|
-
|
|
39
34
|
### 🐛 Bug fixes
|
|
40
35
|
|
|
41
36
|
- [iOS] Added guards to avoid task options to crash the app. ([#35477](https://github.com/expo/expo/pull/35477) by [@chrfalch](https://github.com/chrfalch))
|
|
42
37
|
- [iOS] Added error handler to the streaming location/heading methods since these can fail while streaming ([#35004](https://github.com/expo/expo/pull/35004) by [@chrfalch](https://github.com/chrfalch))
|
|
43
38
|
|
|
44
|
-
## 18.0.6
|
|
39
|
+
## 18.0.6 - 2025-02-10
|
|
45
40
|
|
|
46
41
|
### 🐛 Bug fixes
|
|
47
42
|
|
|
48
43
|
- [Android] Use less specific exception in catch block of `resolveUserSettingsForRequest`. ([#34784](https://github.com/expo/expo/pull/34784) by [@alanjhughes](https://github.com/alanjhughes))
|
|
49
44
|
|
|
50
|
-
## 18.0.5
|
|
45
|
+
## 18.0.5 - 2025-01-10
|
|
51
46
|
|
|
52
47
|
_This version does not introduce any user-facing changes._
|
|
53
48
|
|
|
54
|
-
## 18.0.4
|
|
49
|
+
## 18.0.4 - 2024-12-10
|
|
55
50
|
|
|
56
51
|
_This version does not introduce any user-facing changes._
|
|
57
52
|
|
|
58
|
-
## 18.0.3
|
|
53
|
+
## 18.0.3 - 2024-11-29
|
|
59
54
|
|
|
60
55
|
_This version does not introduce any user-facing changes._
|
|
61
56
|
|
package/android/build.gradle
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
plugins {
|
|
2
|
+
id 'com.android.library'
|
|
3
|
+
id 'expo-module-gradle-plugin'
|
|
4
|
+
}
|
|
2
5
|
|
|
3
6
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '18.0.
|
|
5
|
-
|
|
6
|
-
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
|
-
apply from: expoModulesCorePlugin
|
|
8
|
-
applyKotlinExpoModulesCorePlugin()
|
|
9
|
-
useCoreDependencies()
|
|
10
|
-
useDefaultAndroidSdkVersions()
|
|
11
|
-
useExpoPublishing()
|
|
7
|
+
version = '18.0.11-canary-20250403-13261ac'
|
|
12
8
|
|
|
13
9
|
android {
|
|
14
10
|
namespace "expo.modules.location"
|
|
15
11
|
defaultConfig {
|
|
16
12
|
versionCode 29
|
|
17
|
-
versionName "18.0.
|
|
13
|
+
versionName "18.0.11-canary-20250403-13261ac"
|
|
14
|
+
consumerProguardFiles("proguard-rules.pro")
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
dependencies {
|
|
22
19
|
api 'com.google.android.gms:play-services-location:21.0.1'
|
|
23
|
-
implementation
|
|
20
|
+
implementation 'androidx.annotation:annotation:1.7.1'
|
|
24
21
|
}
|
|
@@ -16,8 +16,6 @@ import expo.modules.location.records.LocationLastKnownOptions
|
|
|
16
16
|
import expo.modules.location.records.LocationOptions
|
|
17
17
|
import expo.modules.location.records.LocationResponse
|
|
18
18
|
import expo.modules.location.records.PermissionRequestResponse
|
|
19
|
-
import io.nlopez.smartlocation.location.config.LocationAccuracy
|
|
20
|
-
import io.nlopez.smartlocation.location.config.LocationParams
|
|
21
19
|
import kotlin.coroutines.resume
|
|
22
20
|
import kotlin.coroutines.resumeWithException
|
|
23
21
|
import kotlin.coroutines.suspendCoroutine
|
|
@@ -110,16 +108,16 @@ class LocationHelpers {
|
|
|
110
108
|
|
|
111
109
|
private fun mapOptionsToLocationParams(options: LocationOptions): LocationParams {
|
|
112
110
|
val accuracy = options.accuracy
|
|
113
|
-
val
|
|
111
|
+
val locationParams = buildLocationParamsForAccuracy(accuracy)
|
|
114
112
|
|
|
115
113
|
options.timeInterval?.let {
|
|
116
|
-
|
|
114
|
+
locationParams.interval = it
|
|
117
115
|
}
|
|
118
116
|
options.distanceInterval?.let {
|
|
119
|
-
|
|
117
|
+
locationParams.distance = it.toFloat()
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
return
|
|
120
|
+
return locationParams
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
private fun mapAccuracyToPriority(accuracy: Int): Int {
|
|
@@ -131,42 +129,15 @@ class LocationHelpers {
|
|
|
131
129
|
}
|
|
132
130
|
}
|
|
133
131
|
|
|
134
|
-
private fun buildLocationParamsForAccuracy(accuracy: Int): LocationParams
|
|
132
|
+
private fun buildLocationParamsForAccuracy(accuracy: Int): LocationParams {
|
|
135
133
|
return when (accuracy) {
|
|
136
|
-
LocationModule.ACCURACY_LOWEST -> LocationParams.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
LocationModule.
|
|
142
|
-
|
|
143
|
-
.setDistance(1000f)
|
|
144
|
-
.setInterval(5000)
|
|
145
|
-
|
|
146
|
-
LocationModule.ACCURACY_BALANCED -> LocationParams.Builder()
|
|
147
|
-
.setAccuracy(LocationAccuracy.MEDIUM)
|
|
148
|
-
.setDistance(100f)
|
|
149
|
-
.setInterval(3000)
|
|
150
|
-
|
|
151
|
-
LocationModule.ACCURACY_HIGH -> LocationParams.Builder()
|
|
152
|
-
.setAccuracy(LocationAccuracy.HIGH)
|
|
153
|
-
.setDistance(50f)
|
|
154
|
-
.setInterval(2000)
|
|
155
|
-
|
|
156
|
-
LocationModule.ACCURACY_HIGHEST -> LocationParams.Builder()
|
|
157
|
-
.setAccuracy(LocationAccuracy.HIGH)
|
|
158
|
-
.setDistance(25f)
|
|
159
|
-
.setInterval(1000)
|
|
160
|
-
|
|
161
|
-
LocationModule.ACCURACY_BEST_FOR_NAVIGATION -> LocationParams.Builder()
|
|
162
|
-
.setAccuracy(LocationAccuracy.HIGH)
|
|
163
|
-
.setDistance(0f)
|
|
164
|
-
.setInterval(500)
|
|
165
|
-
|
|
166
|
-
else -> LocationParams.Builder()
|
|
167
|
-
.setAccuracy(LocationAccuracy.MEDIUM)
|
|
168
|
-
.setDistance(100f)
|
|
169
|
-
.setInterval(3000)
|
|
134
|
+
LocationModule.ACCURACY_LOWEST -> LocationParams(accuracy = LocationAccuracy.LOWEST, distance = 3000f, interval = 10000)
|
|
135
|
+
LocationModule.ACCURACY_LOW -> LocationParams(accuracy = LocationAccuracy.LOW, distance = 1000f, interval = 5000)
|
|
136
|
+
LocationModule.ACCURACY_BALANCED -> LocationParams(accuracy = LocationAccuracy.MEDIUM, distance = 100f, interval = 3000)
|
|
137
|
+
LocationModule.ACCURACY_HIGH -> LocationParams(accuracy = LocationAccuracy.HIGH, distance = 50f, interval = 2000)
|
|
138
|
+
LocationModule.ACCURACY_HIGHEST -> LocationParams(accuracy = LocationAccuracy.HIGH, distance = 25f, interval = 1000)
|
|
139
|
+
LocationModule.ACCURACY_BEST_FOR_NAVIGATION -> LocationParams(accuracy = LocationAccuracy.HIGH, distance = 0f, interval = 500)
|
|
140
|
+
else -> LocationParams(accuracy = LocationAccuracy.MEDIUM, distance = 100f, interval = 3000)
|
|
170
141
|
}
|
|
171
142
|
}
|
|
172
143
|
|
|
@@ -4,6 +4,7 @@ import android.Manifest
|
|
|
4
4
|
import android.app.Activity
|
|
5
5
|
import android.content.Context
|
|
6
6
|
import android.content.Intent
|
|
7
|
+
import android.content.pm.PackageManager
|
|
7
8
|
import android.hardware.GeomagneticField
|
|
8
9
|
import android.hardware.Sensor
|
|
9
10
|
import android.hardware.SensorEvent
|
|
@@ -11,11 +12,14 @@ import android.hardware.SensorEventListener
|
|
|
11
12
|
import android.hardware.SensorManager
|
|
12
13
|
import android.location.Geocoder
|
|
13
14
|
import android.location.Location
|
|
15
|
+
import android.location.LocationManager
|
|
14
16
|
import android.os.Build
|
|
15
17
|
import android.os.Bundle
|
|
16
18
|
import android.os.Looper
|
|
17
19
|
import android.util.Log
|
|
18
20
|
import androidx.annotation.ChecksSdkIntAtLeast
|
|
21
|
+
import androidx.core.app.ActivityCompat
|
|
22
|
+
import androidx.core.location.LocationManagerCompat
|
|
19
23
|
import androidx.core.os.bundleOf
|
|
20
24
|
import com.google.android.gms.common.api.ApiException
|
|
21
25
|
import com.google.android.gms.common.api.CommonStatusCodes
|
|
@@ -51,9 +55,6 @@ import expo.modules.location.records.ReverseGeocodeLocation
|
|
|
51
55
|
import expo.modules.location.records.ReverseGeocodeResponse
|
|
52
56
|
import expo.modules.location.taskConsumers.GeofencingTaskConsumer
|
|
53
57
|
import expo.modules.location.taskConsumers.LocationTaskConsumer
|
|
54
|
-
import io.nlopez.smartlocation.SmartLocation
|
|
55
|
-
import io.nlopez.smartlocation.geocoding.utils.LocationAddress
|
|
56
|
-
import io.nlopez.smartlocation.location.config.LocationParams
|
|
57
58
|
import java.util.Locale
|
|
58
59
|
import kotlin.coroutines.resume
|
|
59
60
|
import kotlin.coroutines.resumeWithException
|
|
@@ -157,21 +158,12 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
AsyncFunction<LocationProviderStatus>("getProviderStatusAsync") {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return@AsyncFunction LocationProviderStatus().apply {
|
|
163
|
-
backgroundModeEnabled = state.locationServicesEnabled()
|
|
164
|
-
gpsAvailable = state.isGpsAvailable
|
|
165
|
-
networkAvailable = state.isNetworkAvailable
|
|
166
|
-
locationServicesEnabled = state.locationServicesEnabled()
|
|
167
|
-
passiveAvailable = state.isPassiveAvailable
|
|
168
|
-
}
|
|
161
|
+
return@AsyncFunction getProviderStatus()
|
|
169
162
|
}
|
|
170
163
|
|
|
171
164
|
AsyncFunction("watchDeviceHeading") { watchId: Int ->
|
|
172
165
|
mHeadingId = watchId
|
|
173
|
-
startHeadingUpdate()
|
|
174
|
-
return@AsyncFunction
|
|
166
|
+
return@AsyncFunction startHeadingUpdate()
|
|
175
167
|
}
|
|
176
168
|
|
|
177
169
|
AsyncFunction("watchPositionImplAsync") { watchId: Int, options: LocationOptions, promise: Promise ->
|
|
@@ -214,7 +206,6 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
|
|
|
214
206
|
} else {
|
|
215
207
|
removeLocationUpdatesForRequest(watchId)
|
|
216
208
|
}
|
|
217
|
-
return@AsyncFunction
|
|
218
209
|
}
|
|
219
210
|
|
|
220
211
|
AsyncFunction("geocodeAsync") Coroutine { address: String ->
|
|
@@ -341,6 +332,23 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
|
|
|
341
332
|
} ?: throw NoPermissionsModuleException()
|
|
342
333
|
}
|
|
343
334
|
|
|
335
|
+
private fun getProviderStatus(): LocationProviderStatus {
|
|
336
|
+
val manager = mContext.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
|
337
|
+
|
|
338
|
+
val isGpsAvailable = manager.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
|
339
|
+
val isNetworkAvailable = manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
|
|
340
|
+
val isLocationServicesEnabled = LocationManagerCompat.isLocationEnabled(manager)
|
|
341
|
+
val isPassiveAvailable = manager.isProviderEnabled(LocationManager.PASSIVE_PROVIDER)
|
|
342
|
+
|
|
343
|
+
return LocationProviderStatus().apply {
|
|
344
|
+
backgroundModeEnabled = isLocationServicesEnabled
|
|
345
|
+
gpsAvailable = isGpsAvailable
|
|
346
|
+
networkAvailable = isNetworkAvailable
|
|
347
|
+
locationServicesEnabled = isLocationServicesEnabled
|
|
348
|
+
passiveAvailable = isPassiveAvailable
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
344
352
|
private suspend fun requestBackgroundPermissionsAsync(): PermissionRequestResponse {
|
|
345
353
|
if (!isBackgroundPermissionInManifest()) {
|
|
346
354
|
throw NoPermissionInManifestException("ACCESS_BACKGROUND_LOCATION")
|
|
@@ -500,27 +508,54 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
|
|
|
500
508
|
}
|
|
501
509
|
|
|
502
510
|
private fun startHeadingUpdate() {
|
|
503
|
-
val
|
|
504
|
-
|
|
505
|
-
|
|
511
|
+
val locationManager = mContext.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
|
512
|
+
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
|
513
|
+
ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
|
|
514
|
+
) {
|
|
515
|
+
return
|
|
516
|
+
}
|
|
517
|
+
val lastLocation =
|
|
518
|
+
locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)
|
|
519
|
+
?: locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)
|
|
520
|
+
|
|
521
|
+
if (lastLocation != null) {
|
|
506
522
|
mGeofield = GeomagneticField(
|
|
507
|
-
|
|
523
|
+
lastLocation.latitude.toFloat(),
|
|
524
|
+
lastLocation.longitude.toFloat(),
|
|
525
|
+
lastLocation.altitude.toFloat(),
|
|
508
526
|
System.currentTimeMillis()
|
|
509
527
|
)
|
|
510
528
|
} else {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
)
|
|
529
|
+
val locationRequest = LocationRequest.Builder(
|
|
530
|
+
LocationRequest.PRIORITY_HIGH_ACCURACY,
|
|
531
|
+
0L
|
|
532
|
+
).setMaxUpdates(1)
|
|
533
|
+
.build()
|
|
534
|
+
|
|
535
|
+
val locationCallback = object : LocationCallback() {
|
|
536
|
+
override fun onLocationResult(locationResult: LocationResult) {
|
|
537
|
+
locationResult.lastLocation?.let {
|
|
538
|
+
mGeofield = GeomagneticField(
|
|
539
|
+
it.latitude.toFloat(),
|
|
540
|
+
it.longitude.toFloat(),
|
|
541
|
+
it.altitude.toFloat(),
|
|
542
|
+
System.currentTimeMillis()
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
}
|
|
516
546
|
}
|
|
547
|
+
mLocationProvider.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper())
|
|
517
548
|
}
|
|
518
549
|
mSensorManager.registerListener(
|
|
519
550
|
this,
|
|
520
551
|
mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
|
|
521
552
|
SensorManager.SENSOR_DELAY_NORMAL
|
|
522
553
|
)
|
|
523
|
-
mSensorManager.registerListener(
|
|
554
|
+
mSensorManager.registerListener(
|
|
555
|
+
this,
|
|
556
|
+
mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
|
|
557
|
+
SensorManager.SENSOR_DELAY_NORMAL
|
|
558
|
+
)
|
|
524
559
|
}
|
|
525
560
|
|
|
526
561
|
private fun sendUpdate() {
|
|
@@ -598,7 +633,6 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
|
|
|
598
633
|
private fun stopWatching() {
|
|
599
634
|
// if permissions not granted it won't work anyway, but this can be invoked when permission dialog appears
|
|
600
635
|
if (Geocoder.isPresent() && !isMissingForegroundPermissions()) {
|
|
601
|
-
SmartLocation.with(mContext).geocoding().stop()
|
|
602
636
|
mGeocoderPaused = true
|
|
603
637
|
}
|
|
604
638
|
for (requestId in mLocationCallbacks.keys) {
|
|
@@ -665,8 +699,10 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
|
|
|
665
699
|
locations?.let { location ->
|
|
666
700
|
location.let {
|
|
667
701
|
val results = it.mapNotNull { address ->
|
|
668
|
-
val
|
|
669
|
-
|
|
702
|
+
val newLocation = Location(LocationManager.GPS_PROVIDER)
|
|
703
|
+
newLocation.latitude = address.latitude
|
|
704
|
+
newLocation.longitude = address.longitude
|
|
705
|
+
GeocodeResponse.from(newLocation)
|
|
670
706
|
}
|
|
671
707
|
continuation.resume(results)
|
|
672
708
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LocationEventEmitter: import("expo
|
|
1
|
+
export declare const LocationEventEmitter: import("expo").EventEmitterType<Record<never, never>>;
|
|
2
2
|
//# sourceMappingURL=LocationEventEmitter.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationEventEmitter.web.d.ts","sourceRoot":"","sources":["../src/LocationEventEmitter.web.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"LocationEventEmitter.web.d.ts","sourceRoot":"","sources":["../src/LocationEventEmitter.web.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,uDAAqB,CAAC"}
|
package/expo-module.config.json
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"platforms": [
|
|
3
|
-
"apple",
|
|
4
|
-
"android"
|
|
5
|
-
],
|
|
2
|
+
"platforms": ["apple", "android"],
|
|
6
3
|
"apple": {
|
|
7
|
-
"modules": [
|
|
8
|
-
"LocationModule"
|
|
9
|
-
]
|
|
4
|
+
"modules": ["LocationModule"]
|
|
10
5
|
},
|
|
11
6
|
"android": {
|
|
12
|
-
"modules": [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
]
|
|
7
|
+
"modules": ["expo.modules.location.LocationModule"],
|
|
8
|
+
"publication": {
|
|
9
|
+
"groupId": "host.exp.exponent",
|
|
10
|
+
"artifactId": "expo.modules.location",
|
|
11
|
+
"version": "18.0.11-canary-20250403-13261ac",
|
|
12
|
+
"repository": "local-maven-repo"
|
|
13
|
+
}
|
|
21
14
|
}
|
|
22
15
|
}
|
package/ios/LocationModule.swift
CHANGED
|
@@ -163,9 +163,13 @@ public final class LocationModule: Module {
|
|
|
163
163
|
// Background location
|
|
164
164
|
|
|
165
165
|
AsyncFunction("startLocationUpdatesAsync") { (taskName: String, options: [String: Any]) in
|
|
166
|
+
// There are two ways of starting this service.
|
|
167
|
+
// 1. As a background location service, this requires the background location permission.
|
|
168
|
+
// 2. As a user-initiated foreground service, this does NOT require the background location permission.
|
|
169
|
+
// Unfortunately, we cannot distinguish between those cases.
|
|
170
|
+
// So we only check foreground permission which needs to be granted in both cases.
|
|
166
171
|
try ensureLocationServicesEnabled()
|
|
167
172
|
try ensureForegroundLocationPermissions(appContext)
|
|
168
|
-
try ensureBackgroundLocationPermissions(appContext)
|
|
169
173
|
|
|
170
174
|
guard CLLocationManager.significantLocationChangeMonitoringAvailable() else {
|
|
171
175
|
throw Exceptions.LocationUpdatesUnavailable()
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
009930bf49815cd59874db36ca7f4ab1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
838e05dcb6c21532cad991a724a4ce9ce2a3e572
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d30c5c5e8e013d7356095a0ba9b19939ede75235295cac9193aa27a7601f2d8a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
68920c75933565fda76d75b67d44945458385ade303118b7942cf8e07ad741a25dafc44fa2a5046aaa04f6be46a13ef14d80ac131aedd115061b5ac7c863dc94
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
556b18e4a484251868e2b80fb2400bc9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9eb1d7b49143fadcd5e69eccd214e25b23ca7e49
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1aea5a6b3fd289628062582aad3e511c3dded4b9e1698be4dabea6f8f8dee952
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9d46ba015b36cdb45893d41d39621afaae41598e4823ff3586f60417717930e93d3becddbbd502504546551cdb9a8424a1c595e63a7dc19479b79679de39c2b2
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"formatVersion": "1.1",
|
|
3
|
+
"component": {
|
|
4
|
+
"group": "host.exp.exponent",
|
|
5
|
+
"module": "expo.modules.location",
|
|
6
|
+
"version": "18.0.11-canary-20250403-13261ac",
|
|
7
|
+
"attributes": {
|
|
8
|
+
"org.gradle.status": "release"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"createdBy": {
|
|
12
|
+
"gradle": {
|
|
13
|
+
"version": "8.13"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"variants": [
|
|
17
|
+
{
|
|
18
|
+
"name": "releaseVariantReleaseApiPublication",
|
|
19
|
+
"attributes": {
|
|
20
|
+
"org.gradle.category": "library",
|
|
21
|
+
"org.gradle.dependency.bundling": "external",
|
|
22
|
+
"org.gradle.libraryelements": "aar",
|
|
23
|
+
"org.gradle.usage": "java-api"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": [
|
|
26
|
+
{
|
|
27
|
+
"group": "com.google.android.gms",
|
|
28
|
+
"module": "play-services-location",
|
|
29
|
+
"version": {
|
|
30
|
+
"requires": "21.0.1"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"files": [
|
|
35
|
+
{
|
|
36
|
+
"name": "expo.modules.location-18.0.11-canary-20250403-13261ac.aar",
|
|
37
|
+
"url": "expo.modules.location-18.0.11-canary-20250403-13261ac.aar",
|
|
38
|
+
"size": 184741,
|
|
39
|
+
"sha512": "9d46ba015b36cdb45893d41d39621afaae41598e4823ff3586f60417717930e93d3becddbbd502504546551cdb9a8424a1c595e63a7dc19479b79679de39c2b2",
|
|
40
|
+
"sha256": "1aea5a6b3fd289628062582aad3e511c3dded4b9e1698be4dabea6f8f8dee952",
|
|
41
|
+
"sha1": "9eb1d7b49143fadcd5e69eccd214e25b23ca7e49",
|
|
42
|
+
"md5": "556b18e4a484251868e2b80fb2400bc9"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "releaseVariantReleaseRuntimePublication",
|
|
48
|
+
"attributes": {
|
|
49
|
+
"org.gradle.category": "library",
|
|
50
|
+
"org.gradle.dependency.bundling": "external",
|
|
51
|
+
"org.gradle.libraryelements": "aar",
|
|
52
|
+
"org.gradle.usage": "java-runtime"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": [
|
|
55
|
+
{
|
|
56
|
+
"group": "org.jetbrains.kotlin",
|
|
57
|
+
"module": "kotlin-stdlib-jdk7",
|
|
58
|
+
"version": {
|
|
59
|
+
"requires": "2.0.21"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"group": "androidx.annotation",
|
|
64
|
+
"module": "annotation",
|
|
65
|
+
"version": {
|
|
66
|
+
"requires": "1.7.1"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"group": "com.google.android.gms",
|
|
71
|
+
"module": "play-services-location",
|
|
72
|
+
"version": {
|
|
73
|
+
"requires": "21.0.1"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"files": [
|
|
78
|
+
{
|
|
79
|
+
"name": "expo.modules.location-18.0.11-canary-20250403-13261ac.aar",
|
|
80
|
+
"url": "expo.modules.location-18.0.11-canary-20250403-13261ac.aar",
|
|
81
|
+
"size": 184741,
|
|
82
|
+
"sha512": "9d46ba015b36cdb45893d41d39621afaae41598e4823ff3586f60417717930e93d3becddbbd502504546551cdb9a8424a1c595e63a7dc19479b79679de39c2b2",
|
|
83
|
+
"sha256": "1aea5a6b3fd289628062582aad3e511c3dded4b9e1698be4dabea6f8f8dee952",
|
|
84
|
+
"sha1": "9eb1d7b49143fadcd5e69eccd214e25b23ca7e49",
|
|
85
|
+
"md5": "556b18e4a484251868e2b80fb2400bc9"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "releaseVariantReleaseSourcePublication",
|
|
91
|
+
"attributes": {
|
|
92
|
+
"org.gradle.category": "documentation",
|
|
93
|
+
"org.gradle.dependency.bundling": "external",
|
|
94
|
+
"org.gradle.docstype": "sources",
|
|
95
|
+
"org.gradle.usage": "java-runtime"
|
|
96
|
+
},
|
|
97
|
+
"files": [
|
|
98
|
+
{
|
|
99
|
+
"name": "expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar",
|
|
100
|
+
"url": "expo.modules.location-18.0.11-canary-20250403-13261ac-sources.jar",
|
|
101
|
+
"size": 22886,
|
|
102
|
+
"sha512": "68920c75933565fda76d75b67d44945458385ade303118b7942cf8e07ad741a25dafc44fa2a5046aaa04f6be46a13ef14d80ac131aedd115061b5ac7c863dc94",
|
|
103
|
+
"sha256": "d30c5c5e8e013d7356095a0ba9b19939ede75235295cac9193aa27a7601f2d8a",
|
|
104
|
+
"sha1": "838e05dcb6c21532cad991a724a4ce9ce2a3e572",
|
|
105
|
+
"md5": "009930bf49815cd59874db36ca7f4ab1"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6b99b835971576b0f9729346df1a482a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
75f7eed0d9c2938bb419d05ce01d100bbbfaa3f5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fa68887fdedbd324e9c1c39048cea5fa118f8ba95233655f1d8e5a59265a691a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a111b5a1573a124b8ff3d5700feb7b5cd117a2fd0101f8fabdb8a8f0b4577878454700549424e3b309e914fdac0900e12808c2f21f5103d9d1cb77011e571463
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
4
|
+
<!-- This module was also published with a richer model, Gradle metadata, -->
|
|
5
|
+
<!-- which should be used instead. Do not delete the following line which -->
|
|
6
|
+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
|
|
7
|
+
<!-- that they should prefer consuming it instead. -->
|
|
8
|
+
<!-- do_not_remove: published-with-gradle-metadata -->
|
|
9
|
+
<modelVersion>4.0.0</modelVersion>
|
|
10
|
+
<groupId>host.exp.exponent</groupId>
|
|
11
|
+
<artifactId>expo.modules.location</artifactId>
|
|
12
|
+
<version>18.0.11-canary-20250403-13261ac</version>
|
|
13
|
+
<packaging>aar</packaging>
|
|
14
|
+
<name>expo.modules.location</name>
|
|
15
|
+
<url>https://github.com/expo/expo</url>
|
|
16
|
+
<licenses>
|
|
17
|
+
<license>
|
|
18
|
+
<name>MIT License</name>
|
|
19
|
+
<url>https://github.com/expo/expo/blob/main/LICENSE</url>
|
|
20
|
+
</license>
|
|
21
|
+
</licenses>
|
|
22
|
+
<scm>
|
|
23
|
+
<connection>https://github.com/expo/expo.git</connection>
|
|
24
|
+
<developerConnection>https://github.com/expo/expo.git</developerConnection>
|
|
25
|
+
<url>https://github.com/expo/expo</url>
|
|
26
|
+
</scm>
|
|
27
|
+
<dependencies>
|
|
28
|
+
<dependency>
|
|
29
|
+
<groupId>com.google.android.gms</groupId>
|
|
30
|
+
<artifactId>play-services-location</artifactId>
|
|
31
|
+
<version>21.0.1</version>
|
|
32
|
+
<scope>compile</scope>
|
|
33
|
+
</dependency>
|
|
34
|
+
<dependency>
|
|
35
|
+
<groupId>org.jetbrains.kotlin</groupId>
|
|
36
|
+
<artifactId>kotlin-stdlib-jdk7</artifactId>
|
|
37
|
+
<version>2.0.21</version>
|
|
38
|
+
<scope>runtime</scope>
|
|
39
|
+
</dependency>
|
|
40
|
+
<dependency>
|
|
41
|
+
<groupId>androidx.annotation</groupId>
|
|
42
|
+
<artifactId>annotation</artifactId>
|
|
43
|
+
<version>1.7.1</version>
|
|
44
|
+
<scope>runtime</scope>
|
|
45
|
+
</dependency>
|
|
46
|
+
</dependencies>
|
|
47
|
+
</project>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d0a8f0bca039fa65c7c06debf5cb3f59
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
731afd47fc7eef015b46ffc74c672aa5f7571e91
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a706d719275b9d75851f1d3d8ddea442cf99abe046ba87f665c043f19971161f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
697002f498cd882eec03c073e56b04e523e301bdd5283ffd66cceb21c83c7626dacae879b7f7eb6ee4424c6227dc4515eb688182e6b90cd8596a6d7312d5d3eb
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<metadata>
|
|
3
|
+
<groupId>host.exp.exponent</groupId>
|
|
4
|
+
<artifactId>expo.modules.location</artifactId>
|
|
5
|
+
<versioning>
|
|
6
|
+
<latest>18.0.11-canary-20250403-13261ac</latest>
|
|
7
|
+
<release>18.0.11-canary-20250403-13261ac</release>
|
|
8
|
+
<versions>
|
|
9
|
+
<version>18.0.11-canary-20250403-13261ac</version>
|
|
10
|
+
</versions>
|
|
11
|
+
<lastUpdated>20250402223117</lastUpdated>
|
|
12
|
+
</versioning>
|
|
13
|
+
</metadata>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5a4e58bd357a75b87f3b51d7a1fea43d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
80318fef15d567df23522c6217145c85414370bf
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4eef53f13c6a9e9eeefd2f23a557970d60d9ac32c8069cac63e68620510abae7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ccd7811e4e793eede9e24c683a69c264a0643d9bb792d977e3c0911bcee33703f5f71120f716d7f23bad8166b62ae486410ee2784538b6b88701ee280b1e5ef1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-location",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.11-canary-20250403-13261ac",
|
|
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/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"preset": "expo-module-scripts"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"expo-module-scripts": "
|
|
42
|
+
"expo-module-scripts": "4.0.5-canary-20250403-13261ac"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"expo": "
|
|
45
|
+
"expo": "53.0.0-canary-20250403-13261ac"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "13261ac5856369e1ce42ef4c380d5af1d7a40392"
|
|
48
48
|
}
|
|
Binary file
|