An Android app that displays the "Ortszeit" or true solar time for the user's current location by means of the sun, instead of the time zone the user is in. Built using Golang and Fyne.
For running and building the app:
- Go 1.22 or later
For building the Android APK:
- Android SDK
- Android NDK
- Android Debug Bridge (ADB)
- Clone this repository:
git clone https://github.com/tnglemongrass/OrtszeitApp.git cd OrtszeitApp
- Ensure you have Fyne installed by running:
go get fyne.io/fyne/v2@latest go install fyne.io/fyne/v2/cmd/fyne@latest fyne version
- Install the Android SDK and NDK:
- Download the Android SDK from the official Android website.
- Download the Android NDK from the official Android website.
- Extract the SDK to a directory, for example,
C:\android
. - Extract the NDK to a directory, for example,
C:\android-ndk-r25c
.
- Set the respective environment variables, e.g. in PowerShell:
$env:ANDROID_HOME = "C:\android" $env:ANDROID_NDK_HOME = "C:\android-ndk-r25c" $env:Path += ";C:\android\platform-tools"
- Build and run the CLI app:
cd cmd/cli go build main.go ./cli.exe
- Build and install the Android app:
cd cmd/gui fyne package -os android -appID com.example.ortszeitapp -icon ../../assets/icons/sun.png -name Ortszeit adb install Ortszeit.apk
This repository includes a CLI version of the app, located in cmd/cli/main.go
. To run the CLI:
go run cmd/cli/main.go
The CLI version prints the location, coordinates, timezone, and various calculated local and solar times based on the location. It supports options for using predefined locations (Karlsruhe and Munich) or fetching the user's current IP information (default). It also includes a debug option to print the JSON response and the IPInfo struct.
--karlsruhe
: Use Karlsruhe, Germany as the location instead of the user's current location--munich
: Use Munich, Germany as the location instead of the user's current location--debug
: Print JSON response for debugging purposes
To build an installable Android APK:
- Set up Android SDK and NDK environment variables, e.g. for PowerShell
powershell $env:ANDROID_HOME = "C:\android" $env:ANDROID_NDK_HOME = "C:\android-ndk-r25c" $env:Path += ";C:\android\platform-tools"
- Build the APK from within the
cmd/gui
directoryThis generatescd ./cmd/gui/ $env:ANDROID_HOME="C:\android" $env:ANDROID_NDK_HOME="C:\android-ndk-r25c" fyne package -os android -appID com.example.ortszeitapp -icon ../assets/icons/sun.png -name Ortszeit
Ortszeit.apk
in thecmd/gui
directory. - Install the APK on a connected Android device
If above fails, verify the device is recognized:
$env:Path += ";C:\android\platform-tools" adb install ortszeit.apk
adb devices
Note: USB debugging must be enabled on your smartphone. Enable Developer Options in Settings > About phone by tapping Build number several times.
For more information about mobile packaging with Fyne: https://docs.fyne.io/started/mobile.html
You need an installed c compiler (e.g. via scoop install gcc
).
From within the cmd/gui
directory:
cd .\cmd\gui
fyne package -os windows -appID com.example.ortszeitapp -icon ..\..\assets\icons\sun.png -name Ortszeit
The executable is available as Ortszeit.exe
in that directory.
- The app supports switching between Karlsruhe and Munich locations. Cli also supports IP based geolocation.
- The project development started in a GitHub Codespace.
- Most of this app was developed using the Cline (prev. Claude Dev) plugin in VSCode (on github, on marketplace). The very first lines of code were developed with the commercial model
Anthropic Claude-3-5-Sonnet-20241022
, and iterated further withQwen/Qwen2.5-Coder-32B-Instruct
. The initial Cline log is available here. - The icon was created by Cline with a single instruction and the sonnet model. The exact instructions were create a simple square sun svg icon and also convert it to png and ico. Full conversation is available here.
- The readme was created and updated using Cline automatically or explicitly as needed.
- The initially generated version (Android + Fyne) did not compile and was way too complex to debug even the development setup. I started over with a simple cli version that just displayed the current time and iterated from there. It was much easier for cline to debug the cli on its own. Cline could run the script, read its output, iterate over server error messages, add temporary logging statements for the response jsons, and so on.
- The CLI was then converted to a Fyne app using Cline and the
Qwen/Qwen2.5-Coder-32B-Instruct
model. Conversation log is available here.