I have figured out how to program on an Android phone or tablet. Using Google Cloud Platform and a couple of Android apps, I have a cloud development box, and I can pull up a command line and edit files locally in my Android device.
I’m going to describe the method I use. You can, of course, use different apps that do the same thing. This is just my method of implementation.
Setup up Google cloud platform. See https://cloud.google.com/compute/docs/quickstart
Create an instance named dev-instance. I use a small preemptable insurance to save on money. You can use a larger instance (but not a smaller one). You can choose to make it preemptable or not. Preemptable is nice because if you accidently leave it running, it won’t stay up more than 24 hours.
Install the Android Google Cloud Console app. Also install JuiceSSH and the paid version of DroidEdit.
In JuiceSSH, go to Connections, slide to Identities, and click the plus to create a new identity. In the Nickname fields, enter ‘dev-instance identity’. Under username, type your Google user ID. Press Set next to Private Key. Go to Generate. Change Key Format to RSA. Hit OK to generate the key (this may take a while). Then press the checkmark in the upper right hand corner to save the identity.
When the identity is created, long press it and select Export Public Key. Select Copy to Clipboard.
Go into Google Cloud Console. Go to Resources then to VM Instances. You should see your instance, dev-instance. Click it and select Ssh from the the dots menu in the upper right hand corner. Select Connect via SSH. This will open a console window to your instance. Type
cat >> ~/.ssh/authorized_keys
Be sure there are TWO greater than symbols. Then long press the screen and select Paste. This should paste your private key from JuiceSSH into the window. Press the console window to turn on the extra keyboard. Press Ctrl then ‘d’. Type ‘logout’. We’ll be connecting to the console from JuiceSSH from now on. Press OK to close your session.
You should be on the screen for dev-instance. Scroll to the bottom and expand Compute Engine Details. Long press the entry for External IP and select Copy. Also, write this address down, because we’ll need it later.
Go to JuiceSSH. Slide to Connections and press the plus sign to add a new connection. Under Nickname, type ‘dev instance’. Long press the space for Address and press Paste. This should paste the external IP. Make sure Identity shows ‘dev instance identity’. Hit the check mark in the upper right hand corner to create the connection.
Press the connection to test it. When it asks you to trust the connection, hit OK. You should get a command prompt. Type ‘logout”.
Swipe back to Identities. Long press ‘dev instance identity’. Select Export Private Key, then Copy to Clipboard.
Open DroidEdit (this must be the paid version). Press the drive looking icon to get a file menu. Press New. Long press the empty document and select Paste to paste the private key. Now select Save As from the file menu. Press local, then navigate to /storage/emulated/0. Press the folder plus icon and create a folder named ‘.ssh’ (make sure the folder name starts with a dot). Name the file ‘id_rsa’ and press create.
Go to Settings, then Remote Files. Scroll to the bottom and press Global Private Key Path. Enter ‘/storage/emulated/0/.ssh/id_rsa’. Hit OK. Press Add Remote Server. Server Name should be ‘dev instance’. For Server Address, enter the IP address you wrote down earlier (or go look it up again). For username, enter your Google ID. Check Use Global Private Key. Press Test to check it. If it asks for a passphrase then you’ve done something wrong. Press Save and exit the settings.
And you’re done! You can now program on your phone or tablet. To open files, use DroidEdit. To get a command line, use JuiceSSH. You have to set up the box with your development environment, but once you do, you can program wherever you are, if you just have a phone or tablet and an internet connection.