Building a simple, background app
So, I've managed. It's a bit clunky, but it does what it should.

Here's whatis needed:


Tasker app (2.99$ on the Play Store)
Connectbot
An ssh server you can control


Tasker checks my position every two minutes, connects with connectbot which triggers a shell script on the ssh server.

Generate a public ssh key without password from Connectbot. Go in the key section, long tap and copy the key. You can then send the key to your ssh server so that connectbot can authenticate passwordlessly.

Create a profile in connectbot with a meaningful nickname (in my case "homeflag"). Select post-login automation and insert which command you'd like to run. In my case I have a very simple script called I_am_home:

echo 1 &gt; /home/user/home_flag


so in connectbot post-login automation I would put

/path/to/I_am_home; exit ⏎


this ensures the command is triggered automatically at login and then the connection is closed.

In tasker create a task to send intent (use the search bar to find it), with the following fields:

Action: android.intent.action.VIEW
Data: ssh://user@host:port#homeflage
Target: Activity


Information on how to do this have been found on this dedicated reddit containing a lot of other info and different way to achieve this.

It is then easy enough to have tasker check your location periodically by making an appropriate profile.