问题描述
我有一个扎根的Android平板电脑.我已将本机服务器应用程序(Linux ARM ELF)复制到/data/tmp并运行.仅缺少一件事:我想在平板电脑启动时启动服务器.有几种情况使任务变得更容易:
I have a rooted Android tablet. I've copied my native server application (Linux ARM ELF) to /data/tmp and it runs. There is only one thing missing: I want to launch the server when the tablet boots up. There are several circumstances, which makes the mission easier:
- 该设备已经植根,我可以将任何内容复制到其中,
- 无需安装程序,一旦完成自动启动,任务便完成了,
- 我的服务器程序不需要任何设置,没有文件,没有库,没有root权限,也不需要任何东西.
我既不想玩创建APK包,也不想玩NDK.我正在寻找最简单的方法.可以,如果针对不同的Android发行版有不同的解决方案(我对当前版本2.2和2.3感到迷惑).
I don't wanna play with creating APK package, nor play with NDK. I am searching for the easiest way. It is OK, if there's different solution for different Android distros (I am insterested in current versions, 2.2 and 2.3).
也许我应该使用 inittab ?无论如何,我更喜欢最官方"的解决方案,如果在设备植根的情况下我们可以说官方",那我说我正在寻找尽可能减少黑客"的解决方案.
Maybe I should use inittab? Anyway, I prefer "most official" solution, if we can talk "official" in case of a rooted device, let's say I'm looking for solution with "as less hack just as possible".
更新:我发现了这一点: http://www.androidenea.com/2009/08/init-process-and-initrc.html -我将尝试尝试并解决问题,如果可以的话.
Update: I found this: http://www.androidenea.com/2009/08/init-process-and-initrc.html - I'll try it and close the question, if it's OK.
推荐答案
最简单的方法是APK.我相信您可以创建一个在启动时启动的服务,然后从那里执行您的ELF.您的APK还可以提供一个配置"应用程序,该应用程序可让您安装/卸载ELF,以便在用户删除应用程序APK时可以清除所有文件.
The easiest way is an APK. I believe you can create a service that launches on boot and then execute your ELF from there. Your APK can also provide a "configuration" app which lets you install/uninstall the ELF so all files can be cleaned up if the user removes the application APK.
这篇关于如何在启动时/启动后在有根的Android上启动本机服务器应用程序(ELF)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!