Need to start a reliable, persistent server

1,989 views
Skip to first unread message

Tim Mensch

unread,
Mar 2, 2012, 8:07:39 PM3/2/12
to android-porting
I'm working with a client who needs to have a persistent server run on
a device running Android. The device will be wall-powered, so battery
life is not an issue.

The server is written in portable C/C++ code. I'm well on the way to
getting it all to build on Android, but I'm worried about what I've
heard about Android killing off processes it "doesn't know about."

If I start this process in init.rc, is that all I need to do to
guarantee it will start on boot and stick around indefinitely?

Thanks,

Tim Mensch

Glenn Kasten

unread,
Mar 4, 2012, 11:37:38 AM3/4/12
to android-porting
Yes - you could make it a service (in the init sense of the term), and
put it in an "on restart" clause in the servicemanager section of
init.rc. For an example see mediaserver.

Chris Stratton

unread,
Mar 4, 2012, 4:57:30 PM3/4/12
to android...@googlegroups.com
You probably also want to give it special oom killer values to protect it. 

Zoltan Kuscsik

unread,
Mar 4, 2012, 4:01:28 PM3/4/12
to gka...@android.com, android-porting
Hi,

mission critical services should be written in native code and started by the
init.rc or system server. 

Z


Tim

unread,
Mar 6, 2012, 2:33:17 AM3/6/12
to android...@googlegroups.com, gka...@android.com
Yes, it will be written in native code, and I was planning on using init.rc. I'm not sure what you mean by the "system server," but init.rc should work fine, thanks.

Tim


On Sunday, March 4, 2012 2:01:28 PM UTC-7, zoli2k wrote:
Hi,

mission critical services should be written in native code and started by the
init.rc or system server. 

Z

On Sun, Mar 4, 2012 at 5:37 PM, Glenn Kasten wrote:
Yes - you could make it a service (in the init sense of the term), and
put it in an "on restart" clause in the servicemanager section of
init.rc. For an example see mediaserver.

On Mar 2, 5:07 pm, Tim Mensch  wrote:
Reply all
Reply to author
Forward
0 new messages