this post was submitted on 15 Feb 2024
15 points (94.1% liked)

Android

27992 readers
203 users here now

DROID DOES

Welcome to the droidymcdroidface-iest, Lemmyest (Lemmiest), test, bestest, phoniest, pluckiest, snarkiest, and spiciest Android community on Lemmy (Do not respond)! Here you can participate in amazing discussions and events relating to all things Android.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules


1. All posts must be relevant to Android devices/operating system.


2. Posts cannot be illegal or NSFW material.


3. No spam, self promotion, or upvote farming. Sources engaging in these behavior will be added to the Blacklist.


4. Non-whitelisted bots will be banned.


5. Engage respectfully: Harassment, flamebaiting, bad faith engagement, or agenda posting will result in your posts being removed. Excessive violations will result in temporary or permanent ban, depending on severity.


6. Memes are not allowed to be posts, but are allowed in the comments.


7. Posts from clickbait sources are heavily discouraged. Please de-clickbait titles if it needs to be submitted.


8. Submission statements of any length composed of your own thoughts inside the post text field are mandatory for any microblog posts, and are optional but recommended for article/image/video posts.


Community Resources:


We are Android girls*,

In our Lemmy.world.

The back is plastic,

It's fantastic.

*Well, not just girls: people of all gender identities are welcomed here.


Our Partner Communities:

!android@lemmy.ml


founded 1 year ago
MODERATORS
 

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.

top 5 comments
sorted by: hot top controversial new old
[–] oupson@programming.dev 8 points 9 months ago (2 children)

Have you tried Shizuku or magisk's libsu ?

They both allow you to run services as root (or adb shell user with suzuku).

[–] salvador@lemmy.world 1 points 9 months ago
[–] salvador@lemmy.world 1 points 9 months ago (1 children)

Do they allow run put and run my service from /system ?

[–] oupson@programming.dev 1 points 9 months ago

I don't think so. However, you can write a magisk module that inject content into /system.

[–] Pantherina@feddit.de 3 points 9 months ago

Just disable battery optimization and disable energy saver. Android apps can start if they want, this is only prevented in "battery restricted". Also an app can listen for the Boot event and start directly.

No need for Root.