How to write code on your android device
If you have ever tried coding you know how amazing, how creative and how fulfilling is to create a program that actually works and does exactly what you want. But you probably also know how time consuming it is...⏳
Have you ever thought about how much time we waste by commuting to work every day, or waiting at the doctor, or waiting for a friend who is in an hour late? Wouldn’t be great if we could use this time for something useful? For example coding? 😊
Gladly we always have a device in our pocket which makes this possible 📱
An interesting fact:

The average time spend on smartphones AND tablets is 261 minutes a day (4hrs 33mins) ( source: https://www.bankmycell.com/blog/smartphone-addiction/#chapter2) That is a LOT! This is 1587.75 hours/year. 😮

🤖I used my Android phone a lot for developing my chatbot which you can try here: https://m.me/botsflow

Let’s see how can you use your Android device for coding for FREE (‘cause everyone loves free stuffs):

GitHub

First of all every good code needs to be version handled. For this purpose we can easily create a repository(for free) on GitHub (http://github.com).

Now we need this code on our phone. There are existing Android apps for this, but you either have to pay, or they do not work. If you know any free app for this please let me know in the comments.

Termux

So let’ have a Linux terminal. There are multiple apps for that, but my personal favorite is Termux. (https://termux.com/). Install it on your device.

📝Open it and run the following commands:

                                $ apt update && apt upgrade 
$ apt install git
$ termux-setup-storage
This creates a directory on your $HOME directory with the name storage, which is a symlink to the external storage directory. The storage directory will in turn contain several sub-directories that serve various different purposes. The storage/shared is the root of your device’s external directory, the same that can be accessed by other Android applications. The storage/downloads folder is also available by other apps. Checkout your code to one of these directories. Here is how you can do that:

Navigate(cd FOLDERNAME) to a directory where you want to store your local copy of the source code.

📝Run the following:

                                $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
                            
Enter your credentials and it should clone your project. Termux Now we have the source code on our device. So far so good :)

AIDE web

After we have the code, we need to edit it. For this, my recommendation is to use the AIDE web app (https://play.google.com/store/apps/details?id=com.aide.web). This is a free app except of a few feature which are not necessary. It has a nice and user friendly UI, and it is easy to use. Install this app on your device. Open the app, navigate to your project folder, open a file, and start coding 📝 AIDE web interface After you finished the coding you would like to commit and push your modifications to your Git repo. You can see your changes in this app(by tapping on Commit…), but you cannot commit them in the free version. But luckily we have Termux! 🙂 AIDE web git options 📝Open Termux app and run the following:
                                $ git add .
                                $ git commit -m "YOUR COMMIT MESSAGE"
                                $ git push
                            
That’s it! Your modifications are now in your repository. Easy 😊🐵🥇

Extra info

In Termux you can install a full Node.js server, and run your application on it. How cool is that! You can make a fully functioning web server from your Android device.

This can be helpful when you want to run tests locally on your phone.

Now you can spend your precious time with coding, instead of wasting it.

I hope this article was helpful, if you have any questions, feel free to contact me any time. coding on the go