Hacker News new | ask | show | jobs
by lappet 1590 days ago
A little off topic, but does anyone know the best way to run software on an unused Android phone? For some reason this seems harder than it used to be. My goal is to run Home assistant on it, and I am struggling with issues on Termux right now. There must be a better way.
1 comments

Good luck, it's a hot mess. I spent considerable time last year porting boringproxy to run on Android. There are countless hoops to jump through for running server software, including:

* You have to run it as a foreground service so the user knows it's running. Not a problem in theory but annoying to implement.

* DNS name resolution doesn't work by default (with Golang at least) because android doesn't use resolve.conf. I solved this by setting DNS servers manually to 1.1.1.1, 8.8.8.8, etc.

* You have to do weird hacks in order to run native applications such as Golang programs.

* Android has endless optimizations for battery life that are trying to shut down/throttle your program. One example I would see huge performance differences as soon as I turned the screen off.

Overall I consider Android to be a very hostile environment for native applications, and networked apps in particular. iOS is even worse from what I can tell. We need a mobile OS that respects the user's control over their device. I'm fine with sane defaults, but it should be easy to switch them off. I'm hopeful for the Pinephone, but we have a long way to go.

sigh, thanks for the response. I think I may move onto RaspberryPi instead. Boringproxy looks like an interesting tool.
Honestly for technical users the RPi should be preferred IMO. The reason I want to get Android working is to bring self-hosting to the masses. Turning an old Android phone into a personal cloud by installing a couple apps and putting it in a corner would be huge.

Android is such a pain we might have to settle for shipping custom SD cards for RPi's though.

> an old Android phone into a personal cloud by installing a couple apps and putting it in a corner would be huge.

That's not a bad idea. It does seem like things have to be absolutely app driven. I wonder how backups would work with that? Multiple phones?

The ideal thing would be if you have multiple phones and can store one offsite at a friend's house. But that requires more complicated software and assumes people have multiple old Android phones laying around. I think more likely you'd pay a cloud service to handle backups for you. You just need to provide them with a read-only key then they can access the same way you do.