I have a rooted Android 10. And I’ve written a service (off the class Service) which I want to run under too, in background. A service uses a microphone and location. It’s written in Kotlin.
I’ve not found any information of how to run a service on a rooted device under root. I’ve found some, about running some commands in a service (code) itself under root, though, but it may be only a part of what I need.
How to do it?
Essentially, I want my service to run forever, with elevated preveligies, get itself restarted if it fails, gets killed by Android.
Also, I’ve tried to copy it into /system
and /system/init
directories, but I haven’t been able to, due to “read-only file system”. Nor have I been able to remount it to make it writteable. I’ve managed to make the /
writteable, but it didn’t allow me to copy my service in /system
nonetheless.
Have you tried Shizuku or magisk’s libsu ?
They both allow you to run services as root (or adb shell user with suzuku).
Do they allow run put and run my service from /system ?
I don’t think so. However, you can write a magisk module that inject content into /system.
thx