开发者

How to emulate the process of a background activity is killed by the system because of low memory on Android?

开发者 https://www.devze.com 2023-02-13 03:11 出处:网络
I\'m dealing with the \"Low memory: no more background process\" problem. My activity is at background and killed when the situation occurs.

I'm dealing with the "Low memory: no more background process" problem. My activity is at background and killed when the situation occurs.

I'm trying to save and load the instance state to solve it.

But since it doesn't happen every time. How should I 开发者_高级运维test my activity with this situation?

Thanks!


You can force your process to die through adb.

> adb shell
# ps
# kill -9 <pid>

where <pid> is the process id of your app. Caveat: I don't know if this method of ending the process is the same as when the OS decides it needs more resources.

Another approach might be to do it through Settings (click on your app under Application Management and then on the Force Stop button).

0

精彩评论

暂无评论...
验证码 换一张
取 消