开发者

How to make a native C executable run forever in the Android?

开发者 https://www.devze.com 2023-03-10 08:53 出处:网络
Is there a way to make a native C executable run forever (in background) in Android OS? I have ported libpcap in Android and I made a sniffer. I have a rooted HTC Hero. I run the sniffer in the backgr

Is there a way to make a native C executable run forever (in background) in Android OS? I have ported libpcap in Android and I made a sniffer. I have a rooted HTC Hero. I run the sniffer in the background through this commands:

$ su
# mount -o remount,rw -t vfat /dev/block//vold/179:0 /sdcard
# /sdcard/mysniffer &

I simultaneously run an Android service that browses a list of web pages in a loop fashion. To force my service run forever in the background I acquire a PARTIAL_WAKE_LOCK via an开发者_Python百科droid.os.PowerManager.

The service runs forever in the background but the sniffer is killed from the OS after some time of running..

Is there a way to make it run forever? I want both of these programs running always in the background so as to do some measurements.


I found a way to do this, and conduct my experiments and measurements! :) I just changed the PARTIAL_WAKE_LOCK with a SCREEN_DIM_WAKE_LOCK in my service! I can't understand the reason, but by doing this the native sniffer is not killed by Android.. If someone knows a better solution, please let us know.

0

精彩评论

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

关注公众号