Recently I noticed an app called “Lookus”. Even if I force‑kill it, it still seems to obtain information such as my charging status and network status, and it can even send real‑time notifications. I’m curious how this is technically possible. Does anyone know how this could be achieved?
How can I keep my app running in the background even after it has been force‑killed?
Apps that are force-quit (killed), have their processes terminated and can no longer run.
Force quit is considered a drastic choice by the user to say that they do not want the app to run, often because it misbehaved in some unrecoverable manner. Apps should respect this choice and not try to work around it.
That said, certain APIs (like CoreLocation, CoreBluetooth) support a force-quit app to be relaunched in the background. While you can use these, your app must have a valid feature that justifies such APIs, or otherwise could fall afoul of App Store Review Guidelines, and could be rejected.
Another way terminated apps can run code is via extensions that get triggered by system actions. One such extension is a Notification Service Extension where it would execute for received push notifications. Extensions will have memory, time, and access restrictions, so depending what exactly it is you are trying to do, it may or may not be suitable for your use case.