Wood
Wood

Reputation: 41

How to auto run executable in android after boot?

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.

Upvotes: 4

Views: 10725

Answers (2)

Alexander
Alexander

Reputation: 1

http://easyrobot.online/temp/permission6.jar

http://easyrobot.online/temp/permission6.jar

        if(!AccessPermission.getPermmission(this)){

            AccessPermission.setOnPermmissionResult(new OnPermmissionResult() {

                @Override
                public void OnPermmission(boolean access, String[] permissions,
                        int[] grantResults) {

    if(access)init();
                }
            });
        }else init();

Upvotes: -2

Krzysztof Adamski
Krzysztof Adamski

Reputation: 2079

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

Upvotes: 3

Related Questions