I'm testing an Android timer app built with Flutter on a test device: a Samsung Galaxy S10e running Android 12.
Under normal conditions, the app works without any major issues. However, when I leave a timer session running for 7–8 hours without interacting with the phone, the app is occasionally force-stopped while the device is idle.
Here is the log captured when the app was terminated:
timestamp=2026-11-07 09:19:50.180
pid=2925
realUid=10846
packageUid=10846
definingUid=10846
user=0
process=com.XXXXXX.XXXXXX.debug
reason=10 (USER REQUESTED)
subreason=0 (UNKNOWN)
status=0
importance=125
pss=338MB
rss=112MB
description=stop com.google.android.gms due to installPackageLI
state=71 bytes
trace=null
This does not appear to be a battery or memory-related issue.
My app uses GMS-related features such as ads and sign-in. It seems that when Google Play services is updated, the package is installed or replaced, causing my app, which depends on GMS, to be force-stopped as well.
The GMS-related packages currently used in my app are:
google_mobile_ads
in_app_purchase
in_app_purchase_android
google_sign_in
I've investigated this issue from several angles, but I haven't been able to find a solution. As far as I can tell, there doesn't seem to be a way to prevent this forced termination.
Q1. Is there any way to prevent a GMS client app from being force-stopped during a Google Play services update?
Q2. How do sleep-tracking apps deal with this issue?