react-native-background-geolocation 5.8.1 → 5.8.2

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.
@@ -113,7 +113,6 @@ public class RNBackgroundGeolocationModule
113
113
 
114
114
  public RNBackgroundGeolocationModule(ReactApplicationContext reactContext) {
115
115
  super(reactContext);
116
- reactContext.addLifecycleEventListener(this);
117
116
 
118
117
  TSConfig config = TSConfig.getInstance(getReactApplicationContext());
119
118
  config.setUseCLLocationAccuracy(true);
@@ -138,6 +137,13 @@ public class RNBackgroundGeolocationModule
138
137
  mEvents.add(EventName.ENABLEDCHANGE);
139
138
  mEvents.add(EventName.NOTIFICATIONACTION);
140
139
  mEvents.add(TSAuthorization.NAME);
140
+
141
+ // Last, once TSConfig is built (#2677). The New Architecture constructs this module off the main thread, and
142
+ // when the Activity has already resumed this call posts onHostResume() to the main thread at once, where
143
+ // initializeLocationManager() needs TSConfig. Registered first, the main thread waited for TSConfig's
144
+ // constructor to finish on this thread (or on another, such as BootReceiver's) — an ANR on a slow device.
145
+ // Registered here, an onHostResume that already happened is still delivered: the call posts it.
146
+ reactContext.addLifecycleEventListener(this);
141
147
  }
142
148
 
143
149
  @Override
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-background-geolocation",
3
- "version": "5.8.1",
3
+ "version": "5.8.2",
4
4
  "description": "The most sophisticated cross-platform background location-tracking & geofencing module with battery-conscious motion-detection intelligence",
5
5
  "scripts": {
6
6
  "build": "pnpm run build:expo",