Caveats and ConsiderationsWhile we talked about process priorities in terms of components such as what activities and services you have, keep in mind that these priorities are done at the process level — not the component level. Just one component (say, a foreground service) will push the entire process into the foreground. While the vast majority of apps are a single process, if you have greatly varying lifecycles or an extremely heavyweight portion of your app that is independent of a long running lightweight portion, strongly consider making them separate processes to allow heavyweight processes to be collected sooner rather than later.Just as importantly though, what process category you fall into is based on what is happening at the component level. That means kicking off that super important long running operation in a separate thread from within your Activity might meet with disaster when you suddenly become a background process. Use the tools available to you (a Service or foreground Service based on priority) to ensure that the system is aware of what you’re doing.
android进程回收
最新推荐文章于 2024-04-01 08:25:48 发布