diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-13 10:54:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-13 10:54:41 +0300 |
| commit | b93fcd57868a53ad0f98ed450bd4c964f370442b (patch) | |
| tree | 6d2c398496dae417a98e2705dd13f8c7e8bef3f8 /android_shared_android.go | |
| parent | 4f4d430db11f4d7be9cb7c6562d611f088cc01cc (diff) | |
Android share integration: add overlay manifest and ShareActivity, move Java to android/src/main/java for fyne-cross merge; read shared text from UserCacheDir; load on startup and foreground. Update README for Mage usage.
Diffstat (limited to 'android_shared_android.go')
| -rw-r--r-- | android_shared_android.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/android_shared_android.go b/android_shared_android.go new file mode 100644 index 0000000..b736fab --- /dev/null +++ b/android_shared_android.go @@ -0,0 +1,34 @@ +//go:build android + +package main + +import ( + "os" + "path/filepath" +) + +// readSharedFromCache tries to read the shared text written by the Android activity. +// The activity writes into getCacheDir()/quicklogger-shared.txt; on Go, os.TempDir() +// maps to the same location in Android (app cache directory). +func readSharedFromCache() (string, error) { + dir, derr := os.UserCacheDir() + if derr != nil || dir == "" { + dir = os.TempDir() + } + path := filepath.Join(dir, "quicklogger-shared.txt") + b, err := os.ReadFile(path) + if err != nil { + return "", err + } + // best-effort cleanup; ignore errors + _ = os.Remove(path) + return string(b), nil +} + +func debugSharedPath() string { + dir, _ := os.UserCacheDir() + if dir == "" { + dir = os.TempDir() + } + return filepath.Join(dir, "quicklogger-shared.txt") +} |
