I've added the following snippet to the end of /system/core/rootdir/init.rc file.

on property:dev.bootcomplete=1
    start bootcomplete_handler

service bootcomplete_handler /system/bin/bc_handler.sh
    class main
    user root
    group root

And /system/bin/bc_handler.sh:

echo hi > /data/hi.txt
monkey -p com.example.package 1

What I'm trying to achieve is to run an app when device boots up. That echo is just for test, as I check existence of /data/hi.txt, it won't be created when device boots up. Could someone help me? BTW, I'm using bullhead if matters.


Your service name is too long (or contains invalid characters).

Service names can be at most 16 characters long, and can contain alphanumeric characters, "_", and "-".


attribution: https://stackoverflow.com/a/33088141/1841194

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.