I also write code using my phone when I'm on a bus or the subway. It requires some patience but after getting used to it, the experience is surprisingly pleasant especially if you're familiar with terminal-based tools. My environment consists of:
- Galaxy S24 Ultra
- Termius: I think it is the best terminal emulator and SSH client on Android. The sad thing is that the paid version is a bit too expensive. ($10 per month, no permanent option)
- tmux: Mobile connections are brittle so it is a must.
- Vim: Allows me to navigate the code freely without using arrow keys, which is really useful on the touch keyboard.
Not that of a big deal, but the thing that I think is more pleasant on the phone than on the PC is that I can use my fingerprint to log in to the remote server. The fingerprint is stored in the TPM so it is safe. It feels magical!
Edit: The biggest pain point for me was the limited width of the smartphone screen. It is a bit hard to skim over the code quickly because most lines are severely cut. Text wrapping helps this but personally I hate text wrapping. Keeping landscape mode is not an option because the code area is completely hidden when the touch keyboard is displayed. That's why foldable phones are great for coding, as they have a wider screen. My previous phone was Galaxy Fold and it was a wonderful coding machine.
Try pairing tmux with mosh, it's how I've been working for years whenever I'm forced to admin through a brittle straw. Mosh combats lag pretty well and doesn't care if your connection drops intermittently. https://mosh.org/
I tried Mosh but it didn't fit my taste. It tries to "predict" the state of the screen before being acknowledged by the server, but sometimes the prediction is wrong and Mosh reverts the cursor movement and redraws the affected area of the terminal. For example, when I'm using split windows in Vim or tmux, Mosh allows typed characters to overflow beyond the separator, briefly, until being told "no" by the server. Personally I find this behavior very disturbing. Enduring higher lags was more bearable to me.
I can see how that's off-putting, but I've learned to ignore the occasional cosmetic hiccup and just trust that it will sync up correctly. I use it with --predict=experimental (largely undocumented), which seems to be even more aggressive, but it works great for me.
I wish I could do it. I find even just texting annoying. Also Galaxy phone.
I wonder if my fingers may just be too fat. Although I don't think they are.
Actually I hate doing most things through a phone, and e.g. if a food delivery app has a desktop version I will always use that given the chance.
I have been really impressed lately using Samsung Dex on a XReal Air 2. AR glasses have really improved in the recent years. It gives you a better screen than many small laptops.
For longer trips (train, airplane), add a mechanical wireless bluetooth keyboard (my choice would be a NuPhy Air 75) to feel like a king. For the occasional browser + SSH on the go, it's better (less space + better keyboard + larger screen experience) than bringing my 13" laptop (+ phone).
Gosh they look interesting.
But ridiculously customer unfriendly product naming, and a website that doesn't provide clear information on international shipping just raises so many red flags for me.
Mosh was suggested in another comment, but I’ve found that et (https://eternalterminal.dev/) suits my needs better.
It does nothing to fix lag, but connection failures are handled without a hitch, same session resumes like normal on spotty train wifi and mobile data.
Just the default one. I tried some alternative keyboards and they are better in some ways but in the end the default keyboard was enough. Termius provides input of some special keys (e.g. Ctrl, Alt, Esc, Tab, Home, End) so that's another reason why the default keyboard is enough.
Be sure to check the privacy policy on your default keyboard. I've been burned by that before. The default keyboard on my last galaxy phone was sending every single keystroke to a third party and checking their privacy policy showed they used that data for things like market research, guessing at my level of education, building a psychological profile, detecting my interests, etc. and that they in turn shared that data with others.
I switched to AnySoftKeyboard and although the auto-correct/spellcheck is way worse (understandable since they're not collecting every word everyone's typing) the customization and terminal mode are great. I'd occasionally code on my phone in termux (the largest program written on that device was only around 2000 lines) and it did the job.
Nothing reliable that I know of. To have any hope at all of being able to do that with Android you'd need a rooted device. Without root access "your" phone isn't something you can reasonably hope to secure since Google, your phone carrier, and the manufacture all have privileged access to your device while you don't. Even with a rooted device I'd only use an app that you trust. The default samsung keyboard that phone came with out of the box was downright adversarial so at least I got rid of that, but I don't think of cell phones as something I can really secure or trust in a meaningful way.
Just FYI, this goes for all Android users. I believe iPhone has similar capabilities but I have never tried myself.
Your phone likely accepts a physical keyboard. I have a USB-C input, but can use a travel dongle (female USB-C device accepting USB-A) to attach.
I used this a few times to do some very light work when travelling. A good setup is picking up a cheap bluetooth keyboard/mouse combo and using the female input to get both. Many alternatives to this too, e.g. you can also attach a dock to your phone to get all devices your phone has the hardware to accept, and you'd be surprised what it does accept.
Edit: The biggest pain point for me was the limited width of the smartphone screen. It is a bit hard to skim over the code quickly because most lines are severely cut. Text wrapping helps this but personally I hate text wrapping. Keeping landscape mode is not an option because the code area is completely hidden when the touch keyboard is displayed. That's why foldable phones are great for coding, as they have a wider screen. My previous phone was Galaxy Fold and it was a wonderful coding machine.