Required Reading
Plugin Version
4.19.2
Mobile operating-system(s)
Device Manufacturer(s) and Model(s)
OnePlus 11R 5G,
Device operating-systems(s)
16,
React Native / Expo version
0.79.0
What happened?
Expected Behavior
Should not crash.
Actual Behavior
there were 4 users facing crash issue from firebase console.
Device states: 100% background
1. Fatal Exception: java.lang.StringIndexOutOfBoundsException: length=0; index=0
at java.lang.String.charAt(String.java)
at com.transistorsoft.locationmanager.data.LocationModel.(:17)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.a(:57)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.all(:59)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$v0.run(:10)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
at java.lang.Thread.run(Thread.java:1563)
2. Fatal Exception: android.app.RemoteServiceException
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d81627c u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.ActivityRecognitionService}
Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d81627c u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.ActivityRecognitionService}
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2242)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8587)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
3. Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f25f82a u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.GeofencingService c:com.ss.ndms.react}
Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f25f82a u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.GeofencingService c:com.ss.ndms.react}
at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2516)
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2484)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2806)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:249)
at android.os.Looper.loop(Looper.java:337)
at android.app.ActivityThread.main(ActivityThread.java:9604)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:615)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
4. Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 24 byte allocation with 1096296 free bytes and 1054KB until OOM, target footprint 134217728, growth limit 134217728; failed due to fragmentation (largest possible contiguous allocation 88080384 bytes)
Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 24 byte allocation with 1096296 free bytes and 1054KB until OOM, target footprint 134217728, growth limit 134217728; failed due to fragmentation (largest possible contiguous allocation 88080384 bytes)
at java.lang.String.fastSubstring(String.java)
at java.lang.String.substring(String.java:2069)
at org.json.JSONTokener.nextString(JSONTokener.java:214)
at org.json.JSONTokener.nextValue(JSONTokener.java:111)
at org.json.JSONTokener.readObject(JSONTokener.java:371)
at org.json.JSONTokener.nextValue(JSONTokener.java:104)
at org.json.JSONObject.(JSONObject.java:165)
at org.json.JSONObject.(JSONObject.java:182)
at com.transistorsoft.locationmanager.data.LocationModel.(:27)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.a(:57)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.all(:59)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$v0.run(:10)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Plugin Code and/or Config
const configBackgroundGeolocation: any = {
// testing only start - ENABLE FOR TESTING RELEASE BUILD AT SAME LOCATION
debug: TESTING_MODE_ENABLED, // Shows tracking events in logs
heartbeatInterval: TESTING_MODE_ENABLED ? 1 : undefined, // Send location every 60s when stationary
allowIdenticalLocations: TESTING_MODE_ENABLED,
// fastestLocationUpdateInterval: 5000,
// stationaryRadius,
// desiredAccuracy,
// testing only stop
// reset: true,
autoSync: true,
batchSync: true,
autoSyncThreshold: TESTING_MODE_ENABLED ? 1 : 5,
maxBatchSize: 20,
distanceFilter: TESTING_MODE_ENABLED ? 0 : tenant?.tenantMobileConfig?.trackingDistanceFilter ?? DEFAULT_TRACKING_DISTANCE_FILTER,
disableElasticity: TESTING_MODE_ENABLED ? true : false,
elasticityMultiplier: 1,
locationUpdateInterval: TESTING_MODE_ENABLED ? 10000 : userInfo?.mobileConfig?.trackingGetGPSFrequency ?? tenant?.tenantMobileConfig?.trackingGetGPSFrequency ?? DEFAULT_TRACKING_GET_GPS_FREQUENCY,
logLevel: TESTING_MODE_ENABLED ? BackgroundGeolocation.LOG_LEVEL_VERBOSE : BackgroundGeolocation.LOG_LEVEL_ERROR,
notification: {
title: title,
text: content,
sticky: true,
priority: BackgroundGeolocation.NOTIFICATION_PRIORITY_LOW,
},
stopOnTerminate: false,
startOnBoot: true,
foregroundService: true,
stopOnStationary: false,
showsBackgroundLocationIndicator: true,
locationAuthorizationRequest: 'Always',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${userToken}`,
},
// enableTimestampMeta: true,
httpRootProperty: '.',
authorization: {
strategy: 'JWT',
accessToken: userToken,
refreshToken: token_refresh,
refreshUrl: token_url,
refreshPayload: {
grant_type: 'refresh_token',
refresh_token: '{refreshToken}',
},
expires: token_expired,
},
enableHeadless: true,
url: `${baseUrl}/api/app-base/vdms-tracking/push`,
locationTemplate: locationTemplate,
};
Relevant log output
Required Reading
Plugin Version
4.19.2
Mobile operating-system(s)
Device Manufacturer(s) and Model(s)
OnePlus 11R 5G,
Device operating-systems(s)
16,
React Native / Expo version
0.79.0
What happened?
Expected Behavior
Should not crash.
Actual Behavior
there were 4 users facing crash issue from firebase console. Device states: 100% background
1. Fatal Exception: java.lang.StringIndexOutOfBoundsException: length=0; index=0
at java.lang.String.charAt(String.java)
at com.transistorsoft.locationmanager.data.LocationModel.(:17)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.a(:57)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.all(:59)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$v0.run(:10)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
at java.lang.Thread.run(Thread.java:1563)
2. Fatal Exception: android.app.RemoteServiceException
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d81627c u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.ActivityRecognitionService}
Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d81627c u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.ActivityRecognitionService}
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2242)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8587)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
3. Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f25f82a u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.GeofencingService c:com.ss.ndms.react}
Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f25f82a u0 com.ss.ndms.react/com.transistorsoft.locationmanager.service.GeofencingService c:com.ss.ndms.react}
at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2516)
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2484)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2806)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:249)
at android.os.Looper.loop(Looper.java:337)
at android.app.ActivityThread.main(ActivityThread.java:9604)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:615)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
4. Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 24 byte allocation with 1096296 free bytes and 1054KB until OOM, target footprint 134217728, growth limit 134217728; failed due to fragmentation (largest possible contiguous allocation 88080384 bytes)
Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 24 byte allocation with 1096296 free bytes and 1054KB until OOM, target footprint 134217728, growth limit 134217728; failed due to fragmentation (largest possible contiguous allocation 88080384 bytes)
at java.lang.String.fastSubstring(String.java)
at java.lang.String.substring(String.java:2069)
at org.json.JSONTokener.nextString(JSONTokener.java:214)
at org.json.JSONTokener.nextValue(JSONTokener.java:111)
at org.json.JSONTokener.readObject(JSONTokener.java:371)
at org.json.JSONTokener.nextValue(JSONTokener.java:104)
at org.json.JSONObject.(JSONObject.java:165)
at org.json.JSONObject.(JSONObject.java:182)
at com.transistorsoft.locationmanager.data.LocationModel.(:27)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.a(:57)
at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.all(:59)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$v0.run(:10)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Plugin Code and/or Config
Relevant log output