简体   繁体   中英

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?

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

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

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM