Closed mahdinba97 closed 8 months ago
When you have a crash, the first thing to do (before posting an issue here), is fetch the stacktrace from $ adb logcat
which shows exactly where, what and why,
There is always a stacktrace.
updated logs (got it from logcat). thank you. as i have read the documents and updates that you have mentioned about using EXACT_ALARMS
in android 34, but this permission needs the app to be listed as alarm app, or the core functionality need to be calendar events. which is not correct for our app, so I think we cannot call getCurrenPosition
when the app is in the background?
the interesting fact is that error does not show up in some phones, but happens a lot in others.
updated logs (got it from logcat)
You're saying your app actually crashed from that stacktrace?
this is the only thing suspicious in logcat
That Exception does not cause a crash. It is harmless.
looking for other suspicious trails in the logcat. but appears that this only happens on android 14. so, updating the issue title.
this is another part of the logcat which is about location provider. seems to be related?
02-13 09:23:36.968 1241 1697 E AppOps : Could not forward noteOp of 108 to com.google.android.gms/10225(fused_location_provider)
02-13 09:23:36.968 1241 1697 E AppOps : android.os.DeadObjectException
02-13 09:23:36.968 1241 1697 E AppOps : at android.os.BinderProxy.transactNative(Native Method)
02-13 09:23:36.968 1241 1697 E AppOps : at android.os.BinderProxy.transact(BinderProxy.java:662)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.internal.app.IAppOpsAsyncNotedCallback$Stub$Proxy.opNoted(IAppOpsAsyncNotedCallback.java:118)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.lambda$collectAsyncNotedOp$3(AppOpsService.java:2928)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.$r8$lambda$j7JuBmeFuvKV9Ixgv9xHNEaV-DA(AppOpsService.java:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$$ExternalSyntheticLambda14.accept(R8$$SyntheticClass:0)
02-13 09:23:36.968 1241 1697 E AppOps : at android.os.RemoteCallbackList.broadcast(RemoteCallbackList.java:333)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.collectAsyncNotedOp(AppOpsService.java:2926)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperationUnchecked(AppOpsService.java:2744)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperationImpl(AppOpsService.java:2647)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.-$$Nest$mnoteOperationImpl(AppOpsService.java:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.$r8$lambda$-zO2p3wazaltMFolMcvKOcU7eN4(AppOpsService.java:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher$$ExternalSyntheticLambda3.apply(R8$$SyntheticClass:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.policy.AppOpsPolicy.noteOperation(AppOpsPolicy.java:235)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.noteOperation(AppOpsService.java:6499)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperation(AppOpsService.java:2628)
02-13 09:23:36.968 1241 1697 E AppOps : at android.app.AppOpsManager.noteOpNoThrow(AppOpsManager.java:8521)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.injector.SystemAppOpsHelper.noteOpNoThrow(SystemAppOpsHelper.java:143)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.lambda$onReportSvStatus$2(GnssStatusProvider.java:186)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.$r8$lambda$bVLjJowpD_c4AguJpiz2DzQNnyY(GnssStatusProvider.java:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider$$ExternalSyntheticLambda3.apply(R8$$SyntheticClass:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.listeners.ListenerMultiplexer.deliverToListeners(ListenerMultiplexer.java:626)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.onReportSvStatus(GnssStatusProvider.java:185)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.lambda$reportSvStatus$2(GnssNative.java:1120)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.$r8$lambda$cr9qihzlW6jEpUxoEJIvOMBxpdo(GnssNative.java:0)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative$$ExternalSyntheticLambda25.runOrThrow(R8$$SyntheticClass:0)
02-13 09:23:36.968 1241 1697 E AppOps : at android.os.Binder.withCleanCallingIdentity(Binder.java:462)
02-13 09:23:36.968 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.reportSvStatus(GnssNative.java:1116)
02-13 09:23:36.969 1241 1697 E AppOps : Could not forward noteOp of 108 to com.google.android.gms/10225(network_location_provider)
02-13 09:23:36.969 1241 1697 E AppOps : android.os.DeadObjectException
02-13 09:23:36.969 1241 1697 E AppOps : at android.os.BinderProxy.transactNative(Native Method)
02-13 09:23:36.969 1241 1697 E AppOps : at android.os.BinderProxy.transact(BinderProxy.java:662)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.internal.app.IAppOpsAsyncNotedCallback$Stub$Proxy.opNoted(IAppOpsAsyncNotedCallback.java:118)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.lambda$collectAsyncNotedOp$3(AppOpsService.java:2928)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.$r8$lambda$j7JuBmeFuvKV9Ixgv9xHNEaV-DA(AppOpsService.java:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$$ExternalSyntheticLambda14.accept(R8$$SyntheticClass:0)
02-13 09:23:36.969 1241 1697 E AppOps : at android.os.RemoteCallbackList.broadcast(RemoteCallbackList.java:333)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.collectAsyncNotedOp(AppOpsService.java:2926)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperationUnchecked(AppOpsService.java:2744)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperationImpl(AppOpsService.java:2647)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.-$$Nest$mnoteOperationImpl(AppOpsService.java:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.$r8$lambda$-zO2p3wazaltMFolMcvKOcU7eN4(AppOpsService.java:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher$$ExternalSyntheticLambda3.apply(R8$$SyntheticClass:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.policy.AppOpsPolicy.noteOperation(AppOpsPolicy.java:235)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.noteOperation(AppOpsService.java:6499)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperation(AppOpsService.java:2628)
02-13 09:23:36.969 1241 1697 E AppOps : at android.app.AppOpsManager.noteOpNoThrow(AppOpsManager.java:8521)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.injector.SystemAppOpsHelper.noteOpNoThrow(SystemAppOpsHelper.java:143)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.lambda$onReportSvStatus$2(GnssStatusProvider.java:186)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.$r8$lambda$bVLjJowpD_c4AguJpiz2DzQNnyY(GnssStatusProvider.java:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider$$ExternalSyntheticLambda3.apply(R8$$SyntheticClass:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.listeners.ListenerMultiplexer.deliverToListeners(ListenerMultiplexer.java:626)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.onReportSvStatus(GnssStatusProvider.java:185)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.lambda$reportSvStatus$2(GnssNative.java:1120)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.$r8$lambda$cr9qihzlW6jEpUxoEJIvOMBxpdo(GnssNative.java:0)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative$$ExternalSyntheticLambda25.runOrThrow(R8$$SyntheticClass:0)
02-13 09:23:36.969 1241 1697 E AppOps : at android.os.Binder.withCleanCallingIdentity(Binder.java:462)
02-13 09:23:36.969 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.reportSvStatus(GnssNative.java:1116)
02-13 09:23:36.971 1241 1697 E AppOps : Could not forward noteOp of 108 to com.google.android.gms/10225(fused_location_provider)
02-13 09:23:36.971 1241 1697 E AppOps : android.os.DeadObjectException
02-13 09:23:36.971 1241 1697 E AppOps : at android.os.BinderProxy.transactNative(Native Method)
02-13 09:23:36.971 1241 1697 E AppOps : at android.os.BinderProxy.transact(BinderProxy.java:662)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.internal.app.IAppOpsAsyncNotedCallback$Stub$Proxy.opNoted(IAppOpsAsyncNotedCallback.java:118)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.lambda$collectAsyncNotedOp$3(AppOpsService.java:2928)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.$r8$lambda$j7JuBmeFuvKV9Ixgv9xHNEaV-DA(AppOpsService.java:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$$ExternalSyntheticLambda14.accept(R8$$SyntheticClass:0)
02-13 09:23:36.971 1241 1697 E AppOps : at android.os.RemoteCallbackList.broadcast(RemoteCallbackList.java:333)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.collectAsyncNotedOp(AppOpsService.java:2926)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperationUnchecked(AppOpsService.java:2744)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperationImpl(AppOpsService.java:2647)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.-$$Nest$mnoteOperationImpl(AppOpsService.java:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.$r8$lambda$-zO2p3wazaltMFolMcvKOcU7eN4(AppOpsService.java:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher$$ExternalSyntheticLambda3.apply(R8$$SyntheticClass:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.policy.AppOpsPolicy.noteOperation(AppOpsPolicy.java:235)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.noteOperation(AppOpsService.java:6499)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.appop.AppOpsService.noteOperation(AppOpsService.java:2628)
02-13 09:23:36.971 1241 1697 E AppOps : at android.app.AppOpsManager.noteOpNoThrow(AppOpsManager.java:8521)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.injector.SystemAppOpsHelper.noteOpNoThrow(SystemAppOpsHelper.java:143)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.lambda$onReportSvStatus$2(GnssStatusProvider.java:186)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.$r8$lambda$bVLjJowpD_c4AguJpiz2DzQNnyY(GnssStatusProvider.java:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider$$ExternalSyntheticLambda3.apply(R8$$SyntheticClass:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.listeners.ListenerMultiplexer.deliverToListeners(ListenerMultiplexer.java:626)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.GnssStatusProvider.onReportSvStatus(GnssStatusProvider.java:185)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.lambda$reportSvStatus$2(GnssNative.java:1120)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.$r8$lambda$cr9qihzlW6jEpUxoEJIvOMBxpdo(GnssNative.java:0)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative$$ExternalSyntheticLambda25.runOrThrow(R8$$SyntheticClass:0)
02-13 09:23:36.971 1241 1697 E AppOps : at android.os.Binder.withCleanCallingIdentity(Binder.java:462)
02-13 09:23:36.971 1241 1697 E AppOps : at com.android.server.location.gnss.hal.GnssNative.reportSvStatus(GnssNative.java:1116)
None of that stacktrace references com.transistorsoft
. I have no insight on that.
@christocracy I have the same exact issue on more recent androids and the logs report ANR from com.transistorsoft.locationmanager.service.GeofencingService
Here's related the logcat (I have replace the app package name with com.example.app
):
02-20 21:55:52.830 1570 1690 E ActivityManager: Short FGS timed out: ServiceRecord{815a515 u0 com.example.app/com.transistorsoft.locationmanager.service.GeofencingService}
02-20 21:55:57.830 1570 1690 E ActivityManager: Short FGS procstate demoted: ServiceRecord{815a515 u0 com.example.app/com.transistorsoft.locationmanager.service.GeofencingService}
02-20 21:56:02.830 1570 1690 E ActivityManager: Short FGS ANR'ed: ServiceRecord{815a515 u0 com.example.app/com.transistorsoft.locationmanager.service.GeofencingService}
02-20 21:56:17.203 1570 31728 E ActivityManager: ANR in com.example.app
02-20 21:56:17.203 1570 31728 E ActivityManager: Reason: A foreground service of FOREGROUND_SERVICE_TYPE_SHORT_SERVICE did not stop within a timeout: ComponentInfo{com.example.app/com.transistorsoft.locationmanager.service.GeofencingService}
02-20 21:56:17.208 1570 31728 D ActivityManager: Completed ANR of com.example.app in 14376ms, latency 1ms
02-20 21:56:17.284 1570 1669 D CoreBackPreview: Window{c2cd9e5 u0 Application Not Responding: com.example.app}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper@ce928e3, mPriority=0, mIsAnimationCallback=false}
02-20 21:56:18.809 1570 1669 I ActivityManager: Killing 27811:com.example.app/u0a420 (adj 200): user request after error
02-20 21:56:18.810 1570 1669 D CoreBackPreview: Window{c2cd9e5 u0 Application Not Responding: com.example.app}: Setting back callback null
02-20 21:56:18.907 1570 4350 W ActivityManager: Scheduling restart of crashed service com.example.app/com.transistorsoft.locationmanager.service.TrackingService in 1122344ms for start-requested
02-20 21:56:18.907 1570 4350 W ActivityManager: Scheduling restart of crashed service com.example.app/com.transistorsoft.tsbackgroundfetch.FetchJobService in 1000ms for connection
02-20 21:56:18.907 1570 4350 W ActivityManager: Short FGS brought down without stopping: ServiceRecord{815a515 u0 com.example.app/com.transistorsoft.locationmanager.service.GeofencingService}
Android 14 has introduced radical new restrictions on the operation of foreground services (which this plug-in relies heavily upon).
I do not have any issues with interrupted tracking in the /example app, which I field test almost daily.
@mahdi-ninja you need to provide far more information and code (see the original post for required info)
@christocracy
Here's more information and code. What else do you need?
Plugin version:4.13.5
Platform: Android
OS version: 14
Device manufacturer / model: Pixel 8, Pixel 7, Samsung Galaxy S23
Flutter info (flutter doctor
):
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.3.1 23D60 darwin-arm64, locale
en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.86.2)
[✓] Connected device (4 available)
[✓] Network resources
Plugin config:
Future<void> configureService() async {
try {
BackgroundGeolocation.onGeofence(onGeofenceEvent);
BackgroundGeolocation.onMotionChange(onMotionChange);
await BackgroundGeolocation.ready(
Config(
startOnBoot: true,
stopOnTerminate: false,
logLevel: await _getLogLevel(),
geofenceModeHighAccuracy: true,
desiredAccuracy: Config.DESIRED_ACCURACY_HIGH,
enableHeadless: true,
locationAuthorizationRequest: 'Any',
),
);
} catch (ex) {
print(ex);
}
}
Future<bool> ensureServiceIsStarted() async {
if (!PlatformConfigs.enabledGeofence) return true;
final isTrackingEnabled = await isEnabledTracking();
final state = await BackgroundGeolocation.state;
if (isTrackingEnabled == true) {
if (state.enabled) {
return true;
}
for (int retries = 0; retries < 5; retries++) {
try {
if (retries != 0) await Future.delayed(const Duration(seconds: 2));
final newState = await BackgroundGeolocation.startGeofences();
return newState.enabled;
} catch (e) {
print(e);
Utility.backgroundGeolocationLog(
e.toString(),
isError: true,
);
}
}
return false;
} else {
if (state.enabled) await BackgroundGeolocation.stop();
return true;
}
}
BackgroundGeolocation.onGeofence(onGeofenceEvent); BackgroundGeolocation.onMotionChange(onMotionChange);
You need to show all code, including the code of your event-handlers, not just the function names.
Hey @christocracy Here's the suspicious part (note the sticky: true):
02-24 20:28:32.873 DEBUG [AbstractService a]
🎾 start [GeofencingService startId: 3, eventCount: 1]
02-24 20:28:32.874 DEBUG [AbstractService a]
⚙️︎ FINISH [GeofencingService startId: 3, eventCount: 0, sticky: true]
02-24 20:28:32.878 DEBUG [AbstractService a]
🎾 1:4 [LocationRequestService startId: 4, eventCount: 1]
Try this branch: I simply changed the foregroundServiceType
of the GeofencingService
from shortService
-> location
in the plugin's AndroidManifest
:
Install from branch GeofencingService-foregroundServiceType
📂 pubspec.yaml
:
dependencies:
flutter_background_geolocation:
git:
url: https://github.com/transistorsoft/flutter_background_geolocation.git
ref: GeofencingService-foregroundServiceType
Have you tested this branch yet?
Hey @christocracy Thanks for the update. We've been testing it for the last few days and it's been working fine. Just wanted to do some broader testing before confirming that the issue is fully resolved. But so far, it looks good. Thanks again!
@christocracy That change fixed the ANR issue but it doesn't execute the headless task function in my code. Here's how I register my task:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await App.init();
runApp(MyApp());
bg.BackgroundGeolocation.registerHeadlessTask(headlessTask);
}
// ignore: avoid_void_async
void headlessTask(bg.HeadlessEvent headlessEvent) async {
bg.Logger.info('[BackgroundGeolocation HeadlessTask]: $headlessEvent');
switch (headlessEvent.name) {
case bg.Event.MOTIONCHANGE:
await App.kiwiContainer<GeofenceService>().onMotionChange(headlessEvent.event);
break;
case bg.Event.GEOFENCE:
await App.kiwiContainer<GeofenceService>().onGeofenceEvent(headlessEvent.event);
break;
}
}
When I run the code on Android 14, in headless mode, here's the log that I get:
03-11 13:19:52.241 DEBUG [AbstractService a]
🎾 start [GeofencingService startId: 22, eventCount: 1]
03-11 13:19:52.289 INFO [GeofencingService a]
╔═════════════════════════════════════════════
║ Geofencing Event: EXIT
╠═════════════════════════════════════════════
╟─ 222
╚═════════════════════════════════════════════
03-11 13:19:52.303 DEBUG [HeadlessTask onHeadlessEvent] 💀 [HeadlessTask location]
03-11 13:19:52.306 INFO [SQLiteLocationDAO persist]
✅ INSERT: e6af250f-f782-41ed-a13b-36f87a5bd61f
03-11 13:19:52.307 DEBUG [AbstractService a]
⚙️︎ FINISH [GeofencingService startId: 22, eventCount: 0, sticky: true]
03-11 13:19:52.309 DEBUG [HeadlessTask onHeadlessEvent] 💀 [HeadlessTask geofence]
03-11 13:20:02.276 DEBUG [AbstractService a]
🎾 start [GeofencingService startId: 23, eventCount: 1]
03-11 13:20:02.278 INFO [GeofencingService a]
There's no trace of the log that I've added at the start of the headlessTask function (i.e. bg.Logger.info('[BackgroundGeolocation HeadlessTask]: $headlessEvent')
)
See API docs Config.enableHeadless
Why did you not add @pragma('vm:entry-point')
above your function, as directed?
Thanks @christocracy. You're right, the problem was just @pragma('vm:entry-point')
which was missing after the upgrade.
So, looks like the issue is fully resolved in Android 14. Thanks again.
Are you going to publish a new release soon with this fix or should I just use the GeofencingService-foregroundServiceType
branch for now?
Are you going to publish a new release soon
I'll publish when you let me know that you're satisfied.
Are you going to publish a new release soon
I'll publish when you let me know that you're satisfied.
I am! It is working perfectly fine now. Thanks again!
It's published to 4.14.1
Should this fix also apply to react-native-background-geolocation
in 4.14.1
as well?
I am still getting the below ANR on Android 14 on 4.16.0
:
ANR in com.vehotechnologies.DriverDevelop
PID: 30567
Reason: A foreground service of FOREGROUND_SERVICE_TYPE_SHORT_SERVICE did not stop within a timeout: ComponentInfo{com.mycompany.MyApp/com.transistorsoft.locationmanager.service.LocationRequestService}
ErrorId: c11a4216-c4ed-4495-a54b-0dd520c4a5c9
Frozen: false
Load: 4.26 / 3.82 / 3.69
Should this fix also apply to react-native-background-geolocation in 4.14.1 as well?
The fix was applied to the GeofencingService. Your error comes from LocationRequestService, which by design is for short periods of time (eg .getCurrentPosition:
Should this fix also apply to
react-native-background-geolocation
in4.14.1
as well?I am still getting the below ANR on Android 14 on
4.16.0
:ANR in com.vehotechnologies.DriverDevelop PID: 30567 Reason: A foreground service of FOREGROUND_SERVICE_TYPE_SHORT_SERVICE did not stop within a timeout: ComponentInfo{com.mycompany.MyApp/com.transistorsoft.locationmanager.service.LocationRequestService} ErrorId: c11a4216-c4ed-4495-a54b-0dd520c4a5c9 Frozen: false Load: 4.26 / 3.82 / 3.69
We are also seeing this ANR in Android 14 on 4.16.5
of the react-native-background-geolocation
plugin. (I can also log the issue there, this was just related so wanted to keep context). This ANR happens while the app is open and not when it's killed.
Details of our ANR:
08-06 20:59:01.903 1380 1411 E ActivityManager: Short FGS ANR'ed: ServiceRecord{fd2504e u0 **/com.transistorsoft.locationmanager.service.LocationRequestService}
08-06 20:59:01.906 1380 5419 D ActivityManager: created ANR temporary file:/data/anr/temp_anr_7904267466455187307.txt
08-06 20:59:03.497 1380 5421 D SystemDumpWriter_ANR: Successful to save dumpsys to log/dumpsys_ANR_WindowManager.txt
08-06 20:59:03.498 1380 5421 D SystemDumpWriter_ANR: save dumpsys, duration=1590
08-06 20:59:05.968 1380 5421 E ActivityManager: ANR in **
08-06 20:59:05.972 1380 5421 D ActivityManager: Completed ANR of ** in 4067ms, latency 1ms
App crashes in the background and showing force stop dialog. Only happens in release build. No clue what could happen here.
Your Environment
flutter doctor
): version 3.13.1Expected Behavior
should work fine in background and not show any errors
Actual Behavior
shows force stop dialog sometimes when in background.
Steps to Reproduce
Context
check geofences in the app (and background)
Debug logs
logcat around the crash time
Logs
``` 02-13 09:28:19.009 1241 2808 W AppOps : Noting op not finished: uid 10029 pkg com.example.app code 79 startTime of in progress event=1707803831216 02-13 09:28:19.014 1241 2808 W ActivityManager: Background started FGS: Disallowed [callingPackage: com.example.app; callingUid: 10029; uidState: CEM ; uidBFSL: n/a; intent: Intent { cmp=com.example.app/com.transistorsoft.locationmanager.service.ActivityRecognitionService (has extras) }; code:DENIED; tempAllowListReason: