问题
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:
- the device is already rooted, I can copy anything to it,
- no installer required, the mission is completed, when the autostart is once set up,
- my server program requires no settings, no files, no libs, no root right, nothing at all.
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).
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".
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.
回答1:
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.
来源:https://stackoverflow.com/questions/8524666/how-to-launch-a-native-server-application-elf-on-a-rooted-android-at-after-boo