Is it possible to stop or start a system process from native code directly during runtime

546 views
Skip to first unread message

Gopi

unread,
Jul 13, 2011, 2:48:45 AM7/13/11
to android-ndk
Hi All,

Is it possible to stop or start a system process from native
code directly during runtime...System process i mean like a camera app
which is not a user app process...If possible please guide me how to
do this...

Thank you....

badcc0de

unread,
Jul 13, 2011, 10:26:03 AM7/13/11
to android-ndk
Yes you can do this to stop a service:

setprop ctl.stop <service>

And to start:
setprop ctl.start <service>

setprop is an executable PATH, so you could use the system( ) C
functions call (Not 100% sure if it is supported in Bionic), but if it
isn't you can always fork and exec that image and do it that way.

There may also be an API for it, but I didn't see anything in the NDK
so you would have to use an internal one that could break your
application if the interface changes.

Good luck...

Gopi

unread,
Jul 14, 2011, 6:43:03 AM7/14/11
to android-ndk
Hi bill(badccode),

Thanks a ton for ur reply.

how can i stop/start a particular service from the mediaserver like
audio,camera,inet by using setprop ctl.stop or ctl.start during the
runtime??? because i guess like audio,camera,inet s group under
mediaserver service!!!
Reply all
Reply to author
Forward
0 new messages