3 ms·
I really want to do something similar, but I have a problem: I need to always have my screen on to be able to connect to the phone on localhost:{port} as I regu
by connectbutoff 2y ago
I really want to do something similar, but I have a problem: I need to always have my screen on to be able to connect to the phone on localhost:{port} as I regularly needs to talk on the phone.
In addition to not always needing to have the screen on, it would be good if I could schedule some "extra" battery saving during night when it is not needed.
If it is possible to give only one app possibility to use the internet it would also be good, now I have not bothered to delete all junk apps, and I guess they also waste a lot of energy.
Right now I have seven android phones awake 24/7 with their screen on (dimmed), but I am a bit afraid of fire / battery exploding.
Appreciate any advice on this!
My devices:
Samsung Galaxy A41 64GB
Samsung Galaxy A14 64GB
- tripflag 2y agoif you use Termux to host your service, then you can "Acquire wakelock" to keep it available with the screen off. That's an action-button attached to the Termux notification, and I believe also the main reason Termux has a notification (to trick android into not background-killing it). I have some quickstart notes here: https://ocv.me/termux/ https://ocv.me/termux/
- denysvitali 2y agoFrom experience (not with Termux but persistent services in general) this partially works. The device will really throttle the CPU / network when the screen is off. This means that your HTTP request instead of taking <200ms will now take 5s. Or at least, this is my experience with a custom app I wrote for Android 13+ running on a Xiaomi device (veux). As soon as you turn on the screen (no need to unlock the device), the web server is immediately responsive as it should be
- tripflag 2y agoThat's curious; maybe this is device/distro-specific? I've had good experience using this approach to transfer files to both my tablet (Samsung s2, lineage) and phone (pixel7, grapheneos). Or maybe Termux is pulling some additional tricks to avoid this issue?
- denysvitali 2y agoIt could be that my device is heavily throttling for saving battery: the device battery (even with this long-running service) lasts multiple weeks on a single charge.