You are going to have a hard time with background usage as Android limits what apps can do in the background.
You can disable battery optimization for your app in the settings, but honestly, network drops will still be a problem, even if you never disconnect the WiFi, just because the devices or uplink can drop the signal.
Hi NotATether,
Thank you for the advice.
Yes, Android background limitations are something I have to consider.
At the moment, I'm disabling battery optimization during testing and keeping the node active in Termux.
My current goal is simply to prove that a lightweight blockchain node can run reliably on Android before optimizing for long-term uptime.
Thank you for pointing this out.
Hi Francesco, welcome in this amazing forum and compliments for trying to set a node in android.
The problem as you say is that your provider CGNAT don't give you a public IP address but an IP shared with much more user. In fact LocalToNet workwith human user and not with automatic API.
In my opinion, you should try the cloudflare tunnel which creates an encrypted tunnel from your phone to cloudflare network, bypassing the CGNAT and you don't need ports or VPS, thereby avoiding HTML blocks.
Hi Italian Panic,
Thank you for your explanation.
Yes, the LocalToNet warning page is exactly what breaks communication between blockchain peers because it returns HTML instead of JSON.
I'll test Cloudflare Tunnel again and see whether it can reliably forward JSON API traffic between nodes.
Thank you for the suggestion.
Have you consider using VPN that support port forwarding? It's sometimes suggested when people ask how their Bitcoin node can accept incoming connection. But you either need to find VPN provider that give port forwarding or manually setup your own VPN instance on a server (that can accept incoming connection normally).
Hi ABCbits,
Thank you for the suggestion.
I hadn't considered VPN providers with port forwarding before.
I'll research VPN solutions that support inbound port forwarding and compare them with Cloudflare Tunnel and FRP.
Thank you for the idea.