• General
  • Solution to important apps closing in background

On my Pixel 4a, Pokemon Go always closes if I switch to one or two other apps. It will close if I dare to open up the camera.

I initially thought this was a memory issue, but I see many people with higher-end phones having this issue too.

Wondering if anyone has advice. Thank you 🙂

I just joined up on this forum to make a post over just this issue... On a Pixel 7 Pro.

This is a persistent problem I've been facing, every once in a while, apps that would stay on for a long time, silently collecting their data in the background (think AccuBattery or the like), are killed off, only to start back up again right away. This normally wouldn't be an issue, except when that app's job is to collect a long history of uninterrupted data in a single session, and does this best when it isn't interrupted.

These same apps were not killed off in this manner in the stock OS, and setting them to Unrestricted battery usage doesn't seem to help much... I even notice Google Play Services killed off and restarting every so often, as I get the silent notification "Sandboxed Google Play is running" again.

What trickery is GrapheneOS up to, and can I do anything about it? It's frustrating. AccuBattery pops up with messages saying it has detected a task killer, even when it hasn't been killed off in a while, so whatever huristics it's running in this manner are detecting something that is killing off tasks. Maybe someone knowledge with GrapheneOS can elaborate?

Edit: added phone model.

    de0u I have one Owner profile only, and do everything in the single profile. Does that help at all? Feel free to ask anything else at all!

      6 days later

      Hmm, is there no solution to this? It's bad enough that I'm considering going back to stock.

        • [deleted]

        • Edited

        thrik to clarify things, has this been happening only recently or all along since you started using it? I presume you use it with unrestricted battery, since you mention it one of your previous posts. Have you recently installed/uninstalled sandboxed Google Play? Have you tried reinstalling the game? I had similar issue with Whatsapp, reinstalling and giving unrestricted battery use put it back to normal. Please describe your issue in greater detail. We can't have you going back to stock, that classes as selfharming.

          [deleted] Thanks for the advice. Isn't uninstalling and reinstalling the sandboxed Google Play more involved? From what I remember, only apps installed after it was reinstalled would be able to use Google Play services. I may be wrong.

          I will try to uninstall and reinstall the app though, I have only let it update, but I guess that's different. And this has been happening much more frequently in the past 6 months, I'd say. I had figured it was my phone showing its age, but I don't think it's that. Been on GOS for about a year now I think.

            • [deleted]

            thrik try reinstalling app only first. Reinstalling Google Play would affect all apps that depend on it.

            Thanks, I will report back after some testing. Tryptamine, I'm curious if you have tried to uninstall and reinstall Accubattery or whatever other apps that were troubling you?

              • [deleted]

              • Edited

              thrik There is another thing I found working for me.
              Using Automation app. It has a trigger, when it detects app not running, it will automatically start it.

              https://server47.de/automation/

              Keep it always running in background. Try it if everything else fails.

                [deleted] I have installed this, but it seems like that trigger doesn't work on Android versions past 7. That would have been neat if I could launch the app like that in the background.

                However, it would still be troubling for how I use this app since I would need to keep on pairing a Bluetooth device with it every time it shut down.

                So, I'm hoping this reinstall did the trick 🙂

                Update: it did not help. Back to square one. It seems really hard to get a response from staff nowadays. I wonder if that means GOS is getting more popular. Although, it's not so great for the average user who needs help from time to time.

                  5 months later

                  thrik Hey! So sorry I've been away for a few months out of country and super busy! During that time I've tried a few things, setting apps to unrestricted battery usage helps a LITTLE bit, but they still get killed off... GrapheneOS has a more strict talk killing/memory managing policy than most ROMs if seems.

                  I'll try that Automation app! It may help. I honestly don't know why some apps I use, like Prevent, manage to stay open in the background just fine without being an Accessibility, Device Admin, Input Method, or Notification Listener. If an app is any of those things, it won't be killed. I've also found that if an app has an App Opp that let's it have a "special use" foreground service (like Google Play Services), it'll stick around no matter what.

                  Otherwise, I've found the best thin you can do to prevent your app from being killed off is to keep a bunch of free RAM. I'm on a Pixel 7 Pro with 12GB total, and if I have less than 2GB free then apps will start to die off. Better to have 3+ GB free. Also, if your ZRAM is full then apps can get killed. Default is a paltry 512MB, I like to increase it to 2GB using a kernel manager, but there's no way to do that without rooting.

                  I also don't condone rooting unless you do so with a locked bootloader. PM me if your interested in that!

                  thrik hey! I know this is a few months old post, but I just found a possible solution! In Developer Options, go to Suspend Eecution for Cached Apps and set it to Disabled. This setting will allow apps to remain in the background executing their code for longer!

                  This seems to be doing something for me. I've moved on from Accubattery, using a root solution (ACCA) instead now, but this seems to keep my current apps alive longer. Might be the solution your looking for!

                  18 days later

                  Ive been scratching my head at this issue as well on my Pixel 7. My issue is specifically with background audio playback. I use audible as well as several TTS enabled readers. They all worked fine until just a little while ago and now all cut out within about a minute if switching away from the app to another. I can tell as soon as it happens because my audio cuts out. If i switch back it picks right back up.

                  I may have found a fix. It seems in the "app info" settings page under "Advanced" options is an "Exploit Protection Compatibility Mode" in the description it says it improves compatibility by using Androids standard memory allocator. Having ticked this option on seems to have solved my issue from what I can tell from testing so far. At least the apps last longer than a minute in the background.

                  It seems not all apps have this option. Haven't figured out what decides if the option s there but current guess is that apps from the app store seem to have it and other apps so far do not. Maybe someone else can confirm.

                    oxika95 It seems not all apps have this option. Haven't figured out what decides if the option s there but current guess is that apps from the app store seem to have it and other apps so far do not. Maybe someone else can confirm.

                    According to the GrapheneOS code comment, the toggle only shows up if the app is a "non-system app that has native 64-bit code"

                      other8026 Thanks for the heads up! This toggle seems to be a working solution from what I can tell. Apps without the toggle though that have the issue i'm not sure how to address, maybe the "Suspend Execution for Cached Apps" in Developer Options like @Tryptamine suggested will work. I'll do some testing and report back.

                        oxika95 That's interesting that Exploit Protection Compatibility Mode solves the problem! I theorized that it might on a similar discussion on the GrapheneOS Reddit here:

                        https://www.reddit.com/r/GrapheneOS/comments/17lty85/ram_management_issues/

                        GrapheneOS (official account) commented that Suspend Execution for Cached Apps should be set to "off" in the background when set to default... I set it to "off" anyways rather than let it use its default behavior. Check out the thread! Its got some relevant info with some interesting comments from GrapheneOS's official account as well.

                        thrik Hey, I did try to uninstall and reinstall Accubattery, and didn't help. I didn't try to enable Exploit Protection Compatibility Mode however... Other apps, depending on which don't have the problem or do. Can't remember which do, but Greenify, Brevent and BatteryGuru don't have the issue. I think that in AppOps if they have the setting "AllowForegroundSpecialProcess" app op and set to "granted", it will remain in foreground as a top app and not get killed.