expo-location 58.0.18 → 58.0.20

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/location/next/LocationModuleNext.kt +6 -6
  4. package/android/src/main/java/expo/modules/location/next/locationForegroundService/LocationForegroundService.kt +7 -0
  5. package/android/src/main/java/expo/modules/location/next/locationProviders/AndroidLocationProvider.kt +9 -3
  6. package/android/src/main/java/expo/modules/location/next/locationProviders/GmsLocationProvider.kt +15 -13
  7. package/android/src/main/java/expo/modules/location/services/LocationTaskService.kt +31 -13
  8. package/android/src/main/java/expo/modules/location/taskConsumers/LocationTaskConsumer.kt +10 -25
  9. package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.18/expo.modules.location-58.0.18-sources.jar → 58.0.20/expo.modules.location-58.0.20-sources.jar} +0 -0
  10. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.md5 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.sha1 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.sha256 +1 -0
  13. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.sha512 +1 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar +0 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.md5 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.sha1 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.sha256 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.sha512 +1 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.18/expo.modules.location-58.0.18.module → 58.0.20/expo.modules.location-58.0.20.module} +22 -22
  20. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.md5 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.sha1 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.sha256 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.sha512 +1 -0
  24. package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.18/expo.modules.location-58.0.18.pom → 58.0.20/expo.modules.location-58.0.20.pom} +1 -1
  25. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.md5 +1 -0
  26. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.sha1 +1 -0
  27. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.sha256 +1 -0
  28. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.sha512 +1 -0
  29. package/package.json +4 -4
  30. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18-sources.jar.md5 +0 -1
  31. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18-sources.jar.sha1 +0 -1
  32. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18-sources.jar.sha256 +0 -1
  33. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18-sources.jar.sha512 +0 -1
  34. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.aar +0 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.aar.md5 +0 -1
  36. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.aar.sha1 +0 -1
  37. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.aar.sha256 +0 -1
  38. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.aar.sha512 +0 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.module.md5 +0 -1
  40. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.module.sha1 +0 -1
  41. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.module.sha256 +0 -1
  42. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.module.sha512 +0 -1
  43. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.pom.md5 +0 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.pom.sha1 +0 -1
  45. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.pom.sha256 +0 -1
  46. package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.18/expo.modules.location-58.0.18.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 58.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - [Android] Fix background location tasks that stop delivering updates after an app update, and the `Context.startForegroundService() did not then call Service.startForeground()` ANR that goes with them. The foreground service now enters the foreground from `onStartCommand` instead of from the asynchronous service connection, and a service that could not be started while the app was in the background is started when the app is resumed. ([#52051](https://github.com/expo/expo/pull/52051) by [@HubertBer](https://github.com/HubertBer))
8
+ - [Android] Remove the stored parent `Context` from the legacy location foreground service. `LocationTaskService` extends `Service`, which is already a `Context`, so it now reads `packageManager`, `packageName` and `resources` from itself. This drops a `lateinit` field and the public `setParentContext` setter. ([#51989](https://github.com/expo/expo/pull/51989) by [@HubertBer](https://github.com/HubertBer))
9
+ - Rebuild precompiled iOS binaries against React Native 0.88.1. ([#52404](https://github.com/expo/expo/pull/52404) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
10
+ - Updated dependencies.
11
+ - @expo/image-utils@0.12.6
12
+
13
+ ## 58.0.19
14
+
15
+ ### Patch Changes
16
+
17
+ - [Android] Use jsLogger for logging where possible, add more logs in silent failure spots. ([#51987](https://github.com/expo/expo/pull/51987) by [@HubertBer](https://github.com/HubertBer))
18
+
3
19
  ## 58.0.18
4
20
 
5
21
  ### Patch Changes
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '58.0.18'
7
+ version = '58.0.20'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.location"
11
11
  defaultConfig {
12
12
  versionCode 29
13
- versionName "58.0.18"
13
+ versionName "58.0.20"
14
14
  consumerProguardFiles("proguard-rules.pro")
15
15
  }
16
16
  }
@@ -3,7 +3,6 @@ package expo.modules.location.next
3
3
  import android.content.Context
4
4
  import android.location.LocationManager
5
5
  import android.os.Build
6
- import android.util.Log
7
6
  import androidx.core.location.LocationManagerCompat
8
7
  import com.google.android.gms.common.ConnectionResult
9
8
  import com.google.android.gms.common.GoogleApiAvailability
@@ -44,7 +43,7 @@ import kotlinx.coroutines.isActive
44
43
  import kotlinx.coroutines.launch
45
44
 
46
45
  private const val MISSING_NOTIFICATION_PERMISSION_WARNING =
47
- "Starting the location foreground service without the `android.permission.POST_NOTIFICATIONS` " +
46
+ "[expo-location] Starting the location foreground service without the `android.permission.POST_NOTIFICATIONS` " +
48
47
  "permission. The service runs and location updates are not throttled, but its notification " +
49
48
  "does not appear in the notification drawer."
50
49
  class TaskManagerNotFoundException : CodedException("TaskManager module not found")
@@ -62,14 +61,15 @@ class LocationModuleNext : Module() {
62
61
 
63
62
  val gmsLocationProvider = GmsLocationProvider(
64
63
  fusedLocationProvider,
65
- LocationServices.getSettingsClient(context)
64
+ LocationServices.getSettingsClient(context),
65
+ appContext.jsLogger
66
66
  ) { GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS }
67
67
 
68
68
  SharedRef(gmsLocationProvider)
69
69
  }
70
70
 
71
71
  val androidLocationProviderInstance: SharedRef<LocationProvider> by lazy {
72
- SharedRef(AndroidLocationProvider(context))
72
+ SharedRef(AndroidLocationProvider(context, appContext.jsLogger))
73
73
  }
74
74
  private val taskManager: TaskManagerInterface by lazy {
75
75
  appContext.legacyModule<TaskManagerInterface>()
@@ -258,7 +258,7 @@ class LocationModuleNext : Module() {
258
258
  }
259
259
  permissionsManager.ensureForegroundServicePermissions()
260
260
  if (!permissionsManager.hasNotificationPermission()) {
261
- Log.w("ExpoLocation", MISSING_NOTIFICATION_PERMISSION_WARNING)
261
+ appContext.jsLogger?.warn(MISSING_NOTIFICATION_PERMISSION_WARNING)
262
262
  }
263
263
 
264
264
  val requested = backgroundSessionOptions
@@ -360,7 +360,7 @@ class LocationModuleNext : Module() {
360
360
  } catch (e: CancellationException) {
361
361
  throw e
362
362
  } catch (e: Exception) {
363
- Log.w("ExpoLocation", "Could not restart the background session after entering the foreground", e)
363
+ appContext.jsLogger?.warn("[expo-location] Could not restart the background session after entering the foreground", e)
364
364
  }
365
365
  }
366
366
  }
@@ -7,6 +7,7 @@ import android.content.Intent
7
7
  import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
8
8
  import android.os.Build
9
9
  import android.os.IBinder
10
+ import android.util.Log
10
11
  import androidx.annotation.ChecksSdkIntAtLeast
11
12
  import androidx.core.app.NotificationManagerCompat
12
13
  import androidx.core.app.ServiceCompat
@@ -46,6 +47,12 @@ class LocationForegroundService : Service() {
46
47
  stopOnTaskRemovedOption = options.stopOnTaskRemoved
47
48
  } catch (t: Throwable) {
48
49
  stopSelf()
50
+ Log.e(
51
+ "ExpoLocation",
52
+ "The location foreground service could not enter the foreground, so the background session did not start " +
53
+ "and background location updates stay throttled.",
54
+ t
55
+ )
49
56
  completePromotion(SessionState.Stopping, ServicePromotionResult.Failed(t))
50
57
  }
51
58
 
@@ -22,6 +22,7 @@ import androidx.core.content.IntentCompat
22
22
  import androidx.core.location.LocationListenerCompat
23
23
  import androidx.core.location.LocationManagerCompat
24
24
  import androidx.core.location.LocationRequestCompat
25
+ import expo.modules.core.logging.Logger
25
26
  import expo.modules.interfaces.taskManager.TaskConsumer
26
27
  import expo.modules.interfaces.taskManager.TaskManagerInterface
27
28
  import expo.modules.interfaces.taskManager.TaskManagerUtilsInterface
@@ -89,7 +90,10 @@ private fun resolveProviderFrom(locationPriority: LocationPriority, validProvide
89
90
  fun resolveSystemProviderName(locationPriority: LocationPriority, context: Context, locationManager: LocationManager): String? =
90
91
  resolveProviderFrom(locationPriority, getValidSystemProviders(context, locationManager))
91
92
 
92
- class AndroidLocationProvider(private val context: Context) : LocationProvider {
93
+ class AndroidLocationProvider(
94
+ private val context: Context,
95
+ private val jsLogger: Logger?
96
+ ) : LocationProvider {
93
97
  val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
94
98
 
95
99
  override val name = "Android"
@@ -134,7 +138,7 @@ class AndroidLocationProvider(private val context: Context) : LocationProvider {
134
138
  if (getValidSystemProviders(context, locationManager).isEmpty()) {
135
139
  return ProviderResult.Unavailable
136
140
  }
137
- return ProviderResult.Available(AndroidPositionUpdatesSession(context, locationManager))
141
+ return ProviderResult.Available(AndroidPositionUpdatesSession(context, locationManager, jsLogger))
138
142
  }
139
143
 
140
144
  override fun getLocationTaskConsumerClass(): ProviderResult<Class<out TaskConsumer>> {
@@ -165,7 +169,8 @@ class AndroidLocationProvider(private val context: Context) : LocationProvider {
165
169
 
166
170
  private class AndroidPositionUpdatesSession(
167
171
  private val context: Context,
168
- private val locationManager: LocationManager
172
+ private val locationManager: LocationManager,
173
+ private val jsLogger: Logger?
169
174
  ) : PositionUpdatesSession, BroadcastReceiver() {
170
175
  private class SessionConfig(val parameters: WatchPositionParameters, val onUpdate: (WatchUpdate) -> Unit)
171
176
  private class SessionState(val listener: LocationListenerCompat, val provider: String)
@@ -200,6 +205,7 @@ private class AndroidPositionUpdatesSession(
200
205
  LocationManagerCompat.requestLocationUpdates(locationManager, provider, request, listener, Looper.getMainLooper())
201
206
  listener
202
207
  }.onFailure {
208
+ jsLogger?.warn("[expo-location] Could not request location updates from \"$provider\"", it)
203
209
  if (emitError) {
204
210
  config.onUpdate(WatchUpdate.Failure(it))
205
211
  }
@@ -7,7 +7,6 @@ import android.content.Context
7
7
  import android.content.Intent
8
8
  import android.location.Location
9
9
  import android.os.Looper
10
- import android.util.Log
11
10
  import com.google.android.gms.common.api.ResolvableApiException
12
11
  import com.google.android.gms.location.CurrentLocationRequest
13
12
  import com.google.android.gms.location.FusedLocationProviderClient
@@ -20,6 +19,7 @@ import com.google.android.gms.location.LocationSettingsRequest
20
19
  import com.google.android.gms.location.Priority
21
20
  import com.google.android.gms.location.SettingsClient
22
21
  import com.google.android.gms.tasks.Task
22
+ import expo.modules.core.logging.Logger
23
23
  import expo.modules.interfaces.taskManager.TaskConsumer
24
24
  import expo.modules.interfaces.taskManager.TaskManagerInterface
25
25
  import expo.modules.interfaces.taskManager.TaskManagerUtilsInterface
@@ -43,24 +43,25 @@ fun LocationPriority.toGmsPriority(): Int {
43
43
  }
44
44
  }
45
45
 
46
- private suspend fun <T> Task<T>.awaitOrNull(): T? {
47
- return suspendCancellableCoroutine { continuation ->
48
- this.addOnSuccessListener { continuation.resume(it) }
49
- this.addOnFailureListener { e ->
50
- Log.w("ExpoLocation", "GMS location task failed", e)
51
- continuation.resume(null)
52
- }
53
- this.addOnCanceledListener { continuation.resume(null) }
54
- }
55
- }
56
-
57
46
  class GmsLocationProvider(
58
47
  val fusedLocationProvider: FusedLocationProviderClient,
59
48
  val settingsClient: SettingsClient,
49
+ private val jsLogger: Logger?,
60
50
  val isServiceAvailable: () -> Boolean
61
51
  ) : LocationProvider {
62
52
  override val name = "GMS"
63
53
 
54
+ private suspend fun <T> Task<T>.awaitOrNull(): T? {
55
+ return suspendCancellableCoroutine { continuation ->
56
+ this.addOnSuccessListener { continuation.resume(it) }
57
+ this.addOnFailureListener { e ->
58
+ jsLogger?.warn("[expo-location] GMS location task failed", e)
59
+ continuation.resume(null)
60
+ }
61
+ this.addOnCanceledListener { continuation.resume(null) }
62
+ }
63
+ }
64
+
64
65
  @SuppressLint("MissingPermission")
65
66
  private suspend fun getCachedOrCurrentLocation(options: GetCurrentPositionOptions): Location? {
66
67
  val request = CurrentLocationRequest
@@ -126,7 +127,8 @@ class GmsLocationProvider(
126
127
  return ProviderResult.Available(enableServicesResult)
127
128
  } catch (e: CancellationException) {
128
129
  throw e
129
- } catch (_: Throwable) {
130
+ } catch (e: Throwable) {
131
+ jsLogger?.warn("[expo-location] Could not check the location settings", e)
130
132
  return ProviderResult.Unavailable
131
133
  }
132
134
  }
@@ -6,21 +6,23 @@ import android.app.NotificationChannel
6
6
  import android.app.NotificationManager
7
7
  import android.app.PendingIntent
8
8
  import android.app.Service
9
- import android.content.Context
10
9
  import android.content.Intent
11
10
  import android.graphics.Color
12
11
  import android.os.Binder
13
12
  import android.os.Build
14
13
  import android.os.Bundle
15
14
  import android.os.IBinder
15
+ import android.util.Log
16
16
 
17
17
  class LocationTaskService : Service() {
18
18
  private var mChannelId: String? = null
19
19
  private var mKillService = false
20
- private lateinit var mParentContext: Context
21
20
  private val mServiceId = sServiceId++
22
21
  private val mBinder: IBinder = ServiceBinder()
23
22
 
23
+ var isPromoted = false
24
+ private set
25
+
24
26
  inner class ServiceBinder : Binder() {
25
27
  val service: LocationTaskService
26
28
  get() = this@LocationTaskService
@@ -36,21 +38,31 @@ class LocationTaskService : Service() {
36
38
  if (extras != null) {
37
39
  mChannelId = extras.getString("appId") + ":" + extras.getString("taskName")
38
40
  mKillService = extras.getBoolean("killService", false)
41
+ extras.getBundle("serviceOptions")?.let {
42
+ try {
43
+ startForeground(it)
44
+ } catch (e: RuntimeException) {
45
+ if (!isStartRejected(e)) {
46
+ throw e
47
+ }
48
+ Log.w(TAG, "Foreground location service could not enter the foreground", e)
49
+ stop()
50
+ }
51
+ }
39
52
  }
40
53
  return START_REDELIVER_INTENT
41
54
  }
42
55
 
43
- fun setParentContext(context: Context) {
44
- // Background location logic is still outside LocationTaskService,
45
- // so we have to save parent context in order to make sure it won't be destroyed by the OS.
46
- mParentContext = context
47
- }
48
-
49
56
  fun stop() {
50
57
  stopForeground(STOP_FOREGROUND_REMOVE)
51
58
  stopSelf()
52
59
  }
53
60
 
61
+ override fun onDestroy() {
62
+ isPromoted = false
63
+ super.onDestroy()
64
+ }
65
+
54
66
  override fun onTaskRemoved(rootIntent: Intent) {
55
67
  if (mKillService) {
56
68
  super.onTaskRemoved(rootIntent)
@@ -61,6 +73,7 @@ class LocationTaskService : Service() {
61
73
  fun startForeground(serviceOptions: Bundle) {
62
74
  val notification = buildServiceNotification(serviceOptions)
63
75
  startForeground(mServiceId, notification)
76
+ isPromoted = true
64
77
  }
65
78
 
66
79
  //region private
@@ -80,7 +93,7 @@ class LocationTaskService : Service() {
80
93
  builder.setColorized(false)
81
94
  }
82
95
 
83
- mParentContext.packageManager.getLaunchIntentForPackage(mParentContext.packageName)?.let {
96
+ packageManager.getLaunchIntentForPackage(packageName)?.let {
84
97
  it.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
85
98
  // We're defaulting to the behaviour prior API 31 (mutable) even though Android recommends immutability
86
99
  val mutableFlag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
@@ -93,9 +106,8 @@ class LocationTaskService : Service() {
93
106
  }
94
107
 
95
108
  val iconsResId = try {
96
- val packageManager = mParentContext.packageManager
97
109
  val ai = packageManager.getApplicationInfo(
98
- mParentContext.packageName,
110
+ packageName,
99
111
  android.content.pm.PackageManager.GET_META_DATA
100
112
  )
101
113
  if (ai.metaData?.containsKey(META_DATA_FOREGROUND_SERVICE_ICON_KEY) == true) {
@@ -104,7 +116,7 @@ class LocationTaskService : Service() {
104
116
  getDefaultNotificationIcon()
105
117
  }
106
118
  } catch (e: Exception) {
107
- android.util.Log.e("expo-location", "Could not fetch default notification icon.", e)
119
+ Log.e(TAG, "Could not fetch default notification icon.", e)
108
120
  getDefaultNotificationIcon()
109
121
  }
110
122
 
@@ -133,7 +145,7 @@ class LocationTaskService : Service() {
133
145
  * requires small notification icons to be monochrome.
134
146
  */
135
147
  private fun getDefaultNotificationIcon(): Int {
136
- return mParentContext.resources.getIdentifier("notification_icon", "drawable", mParentContext.packageName)
148
+ return resources.getIdentifier("notification_icon", "drawable", packageName)
137
149
  .takeIf { it != 0 } ?: applicationInfo.icon
138
150
  }
139
151
 
@@ -146,8 +158,14 @@ class LocationTaskService : Service() {
146
158
  } //endregion
147
159
 
148
160
  companion object {
161
+ private const val TAG = "LocationTaskService"
149
162
  private var sServiceId = 481756
150
163
  const val META_DATA_FOREGROUND_SERVICE_ICON_KEY: String =
151
164
  "expo.modules.location.foreground_service_icon"
165
+
166
+ // ForegroundServiceStartNotAllowedException and BackgroundServiceStartNotAllowedException are IllegalStateExceptions.
167
+ internal fun isStartRejected(e: RuntimeException): Boolean {
168
+ return e is SecurityException || e is IllegalStateException
169
+ }
152
170
  }
153
171
  }
@@ -225,11 +225,12 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
225
225
  extras.putString("appId", task.appScopeKey)
226
226
  extras.putString("taskName", task.name)
227
227
  extras.putBoolean("killService", serviceOptions.getBoolean("killServiceOnDestroy", false))
228
+ extras.putBundle("serviceOptions", serviceOptions)
228
229
  serviceIntent.putExtras(extras)
229
230
  try {
230
231
  context.startForegroundService(serviceIntent)
231
232
  } catch (e: RuntimeException) {
232
- if (!isStartRejected(e)) {
233
+ if (!LocationTaskService.isStartRejected(e)) {
233
234
  throw e
234
235
  }
235
236
  Log.w(TAG, "Foreground location task could not be started", e)
@@ -240,24 +241,10 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
240
241
  object : ServiceConnection {
241
242
  override fun onServiceConnected(name: ComponentName, service: IBinder) {
242
243
  mService = (service as? ServiceBinder)?.service
243
- mService?.let {
244
- it.setParentContext(context)
245
- try {
246
- it.startForeground(serviceOptions)
247
- } catch (e: RuntimeException) {
248
- if (!isStartRejected(e)) {
249
- throw e
250
- }
251
- Log.w(TAG, "Foreground location task could not enter the foreground", e)
252
- releaseService()
253
- return
254
- }
255
- // The task was unregistered while this bind was pending: didUnregister() found no
256
- // service to stop. Stop it now. startForeground() above is still required, since the
257
- // service was started with startForegroundService().
258
- if (mTask == null) {
259
- stopForegroundService()
260
- }
244
+ // The task was unregistered while this bind was pending: didUnregister() found no
245
+ // service to stop. Stop it now.
246
+ if (mTask == null) {
247
+ stopForegroundService()
261
248
  }
262
249
  }
263
250
 
@@ -273,7 +260,7 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
273
260
  try {
274
261
  mService?.startForeground(options.getArguments(FOREGROUND_SERVICE_KEY).toBundle())
275
262
  } catch (e: RuntimeException) {
276
- if (!isStartRejected(e)) {
263
+ if (!LocationTaskService.isStartRejected(e)) {
277
264
  throw e
278
265
  }
279
266
  Log.w(TAG, "Foreground location task could not be restarted", e)
@@ -282,11 +269,6 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
282
269
  }
283
270
  }
284
271
 
285
- // ForegroundServiceStartNotAllowedException and BackgroundServiceStartNotAllowedException are IllegalStateExceptions.
286
- private fun isStartRejected(e: RuntimeException): Boolean {
287
- return e is SecurityException || e is IllegalStateException
288
- }
289
-
290
272
  private fun releaseService() {
291
273
  mService?.stop()
292
274
  mService = null
@@ -408,6 +390,9 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
408
390
 
409
391
  override fun onHostResume() {
410
392
  mIsHostPaused = false
393
+ if (mTask != null && mService?.isPromoted != true) {
394
+ maybeStartForegroundService()
395
+ }
411
396
  maybeReportDeferredLocations()
412
397
  }
413
398
 
@@ -0,0 +1 @@
1
+ 2b7f7a3d9831672e4bf6f5451556e23005a3e40bedb5d8e7012ebd8e7ab2b7fd
@@ -0,0 +1 @@
1
+ 09d55567d11b0c72b1af4bc7eba78e41cdc116311cfe71ce91bcdcabad1b010c978a37114aef9a18c50b15a315191c18dd67271f9535a3d422e315d578874e0f
@@ -0,0 +1 @@
1
+ 748d456a818897b38d93d91265ab70260f5f014334f98ce703b310e4daeb1237
@@ -0,0 +1 @@
1
+ dc38d9642f4d677172d5334e8f814c0d78bb8a96e80ce1451216f27f66a7c56b5e16819294ede17d09697bd523ee39249aeb8d85a6c959820adb08f856c59a4b
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.location",
6
- "version": "58.0.18",
6
+ "version": "58.0.20",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -33,13 +33,13 @@
33
33
  ],
34
34
  "files": [
35
35
  {
36
- "name": "expo.modules.location-58.0.18.aar",
37
- "url": "expo.modules.location-58.0.18.aar",
38
- "size": 581596,
39
- "sha512": "6682331d06ec45656d983858709dd92cb52e7fa0f5a230d4facc0b8538a3b1a53391ee1291baa35c379ce27e7d583fef5679c509ab6d1c3ecb21c5f976951b68",
40
- "sha256": "7dc87682e290b1b75aab7315f20b5c406f015599aabb66b0ddef9239bcaafb4e",
41
- "sha1": "1f00e882accc1f7569f4fac2e03e4ec6deb19291",
42
- "md5": "7e18750f52b3bdc5f594a6b0e7426e59"
36
+ "name": "expo.modules.location-58.0.20.aar",
37
+ "url": "expo.modules.location-58.0.20.aar",
38
+ "size": 581778,
39
+ "sha512": "dc38d9642f4d677172d5334e8f814c0d78bb8a96e80ce1451216f27f66a7c56b5e16819294ede17d09697bd523ee39249aeb8d85a6c959820adb08f856c59a4b",
40
+ "sha256": "748d456a818897b38d93d91265ab70260f5f014334f98ce703b310e4daeb1237",
41
+ "sha1": "493e9b2d73adab3fb1d015bc148e71a665bec63b",
42
+ "md5": "7f6dd0092fd032b9e6f337af4d8ee4cc"
43
43
  }
44
44
  ]
45
45
  },
@@ -90,13 +90,13 @@
90
90
  ],
91
91
  "files": [
92
92
  {
93
- "name": "expo.modules.location-58.0.18.aar",
94
- "url": "expo.modules.location-58.0.18.aar",
95
- "size": 581596,
96
- "sha512": "6682331d06ec45656d983858709dd92cb52e7fa0f5a230d4facc0b8538a3b1a53391ee1291baa35c379ce27e7d583fef5679c509ab6d1c3ecb21c5f976951b68",
97
- "sha256": "7dc87682e290b1b75aab7315f20b5c406f015599aabb66b0ddef9239bcaafb4e",
98
- "sha1": "1f00e882accc1f7569f4fac2e03e4ec6deb19291",
99
- "md5": "7e18750f52b3bdc5f594a6b0e7426e59"
93
+ "name": "expo.modules.location-58.0.20.aar",
94
+ "url": "expo.modules.location-58.0.20.aar",
95
+ "size": 581778,
96
+ "sha512": "dc38d9642f4d677172d5334e8f814c0d78bb8a96e80ce1451216f27f66a7c56b5e16819294ede17d09697bd523ee39249aeb8d85a6c959820adb08f856c59a4b",
97
+ "sha256": "748d456a818897b38d93d91265ab70260f5f014334f98ce703b310e4daeb1237",
98
+ "sha1": "493e9b2d73adab3fb1d015bc148e71a665bec63b",
99
+ "md5": "7f6dd0092fd032b9e6f337af4d8ee4cc"
100
100
  }
101
101
  ]
102
102
  },
@@ -110,13 +110,13 @@
110
110
  },
111
111
  "files": [
112
112
  {
113
- "name": "expo.modules.location-58.0.18-sources.jar",
114
- "url": "expo.modules.location-58.0.18-sources.jar",
115
- "size": 53005,
116
- "sha512": "9d29af38240313fabd305bbd76d5b5bc2879ecdd31d2efe66265712a6af0a6ec7db1582c0591cb13714f9d0a88ef825248deeaa75a67ab6af41af8b70d74d1fb",
117
- "sha256": "4800072f05f734ff0fb00acc4eea3240c3a6509bdec96f50ae800fda47772a83",
118
- "sha1": "055e78abdc14467e4b36d601c1fdb1476644b45b",
119
- "md5": "60629ea45a46bdbe0d67f06226a00d18"
113
+ "name": "expo.modules.location-58.0.20-sources.jar",
114
+ "url": "expo.modules.location-58.0.20-sources.jar",
115
+ "size": 53182,
116
+ "sha512": "09d55567d11b0c72b1af4bc7eba78e41cdc116311cfe71ce91bcdcabad1b010c978a37114aef9a18c50b15a315191c18dd67271f9535a3d422e315d578874e0f",
117
+ "sha256": "2b7f7a3d9831672e4bf6f5451556e23005a3e40bedb5d8e7012ebd8e7ab2b7fd",
118
+ "sha1": "a0c50adf224fdc062d0486556971f5195693c8a7",
119
+ "md5": "454d83e27499bcaff86adba3e5164864"
120
120
  }
121
121
  ]
122
122
  }
@@ -0,0 +1 @@
1
+ a3147f698b1c768d69b436064fe2a31e7ed579e0cd239f9f08a4653ff71a82e1
@@ -0,0 +1 @@
1
+ 0ff9ca953c95a6dda048b57b1fdffd8d22a1e035d7fbce4805f24b73dae6e84d3149f77ac886afccd10738427234df61a1baa593b556861f73bf2f3ee7b14038
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.location</artifactId>
12
- <version>58.0.18</version>
12
+ <version>58.0.20</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.location</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 89ec971b2f6c8a5ac903f4819d2d9a2f747bc0d246a82c1ac8d834902e2b0618
@@ -0,0 +1 @@
1
+ bec57056a243afc5ea6af66d907485ef7bc4bab94a69c303f99076659fed15a9dfebf5039d87ee02621a50f8bb98ec094aeb39557899ab880ab47ad5c813b7ca
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-location",
3
- "version": "58.0.18",
3
+ "version": "58.0.20",
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
  "keywords": [
6
6
  "compass",
@@ -49,14 +49,14 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@expo/image-utils": "^0.12.5"
52
+ "@expo/image-utils": "^0.12.6"
53
53
  },
54
54
  "devDependencies": {
55
- "@expo/internal-scripts": "58.0.3",
55
+ "@expo/internal-scripts": "58.0.5",
56
56
  "@types/jest": "^30.0.0",
57
57
  "@types/node": "^22.14.0",
58
58
  "@types/react": "~19.3.0",
59
- "expo": "58.0.16",
59
+ "expo": "58.0.21",
60
60
  "expo-task-manager": "~58.0.12"
61
61
  },
62
62
  "peerDependencies": {
@@ -1 +0,0 @@
1
- 4800072f05f734ff0fb00acc4eea3240c3a6509bdec96f50ae800fda47772a83
@@ -1 +0,0 @@
1
- 9d29af38240313fabd305bbd76d5b5bc2879ecdd31d2efe66265712a6af0a6ec7db1582c0591cb13714f9d0a88ef825248deeaa75a67ab6af41af8b70d74d1fb
@@ -1 +0,0 @@
1
- 7dc87682e290b1b75aab7315f20b5c406f015599aabb66b0ddef9239bcaafb4e
@@ -1 +0,0 @@
1
- 6682331d06ec45656d983858709dd92cb52e7fa0f5a230d4facc0b8538a3b1a53391ee1291baa35c379ce27e7d583fef5679c509ab6d1c3ecb21c5f976951b68
@@ -1 +0,0 @@
1
- 3de201791026060e114a01d12cd186fc76f87eed338a6763f9bb7baed618509b
@@ -1 +0,0 @@
1
- 16eb2d169b6372f84b7a22e1a1eb5502f2e0ca74d89d6d7bac699f421d4cac3f1f5d34e9fd79035b4c46e72cf8c4ce0e9c891550138f6a76efcd7188855135f7
@@ -1 +0,0 @@
1
- 36237a151c121dce183678916cada7569fc795cbf65540c1b19346ecba2ba538
@@ -1 +0,0 @@
1
- 0b554ad01dc01eb8403481e1f02804d80963630db25087ef6a9106ae40d9ddcecb40af042be8ce187392feec17a6634f55d08bd5f9682031f35d305e58458cd7