How to add C daemon to android project and run it?

http://stackoverflow.com/questions/21299109/how-to-add-c-daemon-to-android-project-and-run-it

I have a daemon written in C language. I also have an android application that uses this daemon via socket. Daemon run with system. Is it possible to add compilled C daemon to android application and run it from application?

++++++++++ answer

I guess it is possible, but just in case your device is rooted.You should include the daemon as part of your application, see NDK if you don't know how to do it, and somwhere in your application code call it like
Runtime.getRuntime().exec("su root " + "path to daemon"); 

where 'su' is super user utility, which forks your application and executes daemon in sepparate proccess with elevated permissions.


<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(64) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
posted @ 2016-02-01 00:00  张同光  阅读(72)  评论(0编辑  收藏  举报