How to auto run executable in android after boot?

Wood picture Wood · Oct 31, 2013 · Viewed 9.3k times · Source

I have an executable in /system/bin which is compiled from a small C program.

I have root, and can run this executable successfully in Re explorer and Script Manager.

Tried init.d method to auto run this executable during boot, but system stuck at boot logo.So I gave it up.

Now I'm wondering how can I auto run executable after system boot in an easy way since I'm a newbee to Android programming?

P.S. Tried Script Manager to run it as root during boot, but system booted without running it.

Answer

Krzysztof Adamski picture Krzysztof Adamski · Apr 6, 2014

You can use /init.rc for that. Just read it and find a suitable place to start your program, add this line there:

start myservice

Then, at the end of this file, define myservice as a service that runs /system/bin/myexecutabe and which is disabled by default (only started when someone issues start command) and is not restarted when it dies (oneshot), like this:

service myservice /system/bin/myexecutable
    disabled
    oneshot