Syncing org files to an Android device


This is an old setup which I dont use anymore. Syncthing has gotten much better and works now good enough for my needs.

The Problem

Since Ive began using org-mode extensivly I thought it would be nice to be able to view the files on my Android device. There is a nice app called Orgzly which you can get from the PlayStore or the F-Droid repository. However Orgzly doesnt include the ability to sync the org files. I finally found a solution to this problem however. Its a bit of a hack but its working very well, which is all that counts.

The Solution

Ive create the solution with my two favourite apps, Tasker and Termux. You can get both apps from the PlayStore. In addition to Termux you will need the app Termux:Task. It allows one to run Shell scripts from Termux in a Tasker task.

Setting up Termux

I will only cover the basic configuration needed to get the sync running. If you want to learn more about Termux I recommend that you go to the official help page.

First you need to run:

packages upgrade

This upgrades the Termux packages to the newest version. I recommend that you restart Termux afterwards. Since I keep my org-files in a git repository Im going to install git in Termux. After the upgrade we can use pkg instead of packages.

pgk install git

Afterwards we need to run:


This will open a prompt on your device with which you can grant Termux access to the internal storage. We will need this to be able to clone the git repository into it. Setting up the git repository is something which I wont cover in this guide. There are plenty of other guides on the web about this topic. Just make sure that you clone the repository somewhere in /sdcard/

As a next step you need to create the directory to store your scripts which will be used by Tasker.

mkdir -p ~/.termux/tasker

Inside that directory I created a script called and made it executable. The content of that script is:


date +"%Y-%m-%d %H:%M" >> ~/notes.log
git -C /sdcard/Git/notes pull >> ~/notes.log
exit 0

This adds the current time and date to a log file in the Termux home directory and pulls in the newest commmits from my notes repository. Since Termux works slightly different than a normal Linux environment we need to execute one last command.

termux-fix-shebang .termux/tasker/

This will correct the sheband #!/bin/bash to one that works with Termux.

Setting up Tasker

Setting up Tasker quite easily done. Im going to asume that your familiar with Tasker and explain only the parts specific to Termux and Orgzly. In general I just created a Profile which executes the sync task every 3 hours.

After youve setup the profile create a Task from the Termux Plugin. You can find it under PluginsTermux:Task. The plugin allows you to specify the script you want to execute. Just write the first few letters of the script name and it will show you all the files which begin with that name. The following screenshots might show it a bit better what I mean.



When you finished the Termux task well setup a task which triggers the sync function of Orgzly. If we wouldnt do this we wouldve the up to date files on the device but they wouldnt show up in the Orgzly app. For this create code task step: CodeRun Shell The command you have to execute is:

am startservice --user 0 -a com.orgzly.intent.action.SYNC\_START com.orgzly/


This is everything we need to setup in Tasker and your task should look something like this.


Once youve saved it Tasker will update the git repository in the specified interval and refresh the Orgzly views.

Previous Post Next Post