File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
mobile/src/main/java/net/activitywatch/android Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ class SyncInterface(context: Context) {
2323 syncDir = " $downloadsDir /ActivityWatch"
2424 Os .setenv(" AW_SYNC_DIR" , syncDir, true )
2525
26+ // Set XDG environment variables to app-writable paths
27+ // This is required for aw-client-rust (used by aw-sync) to create lock files
28+ val cacheDir = context.cacheDir.absolutePath
29+ val filesDir = context.filesDir.absolutePath
30+
31+ Os .setenv(" XDG_CACHE_HOME" , cacheDir, true )
32+ Os .setenv(" XDG_CONFIG_HOME" , " $filesDir /config" , true )
33+ Os .setenv(" XDG_DATA_HOME" , " $filesDir /data" , true )
34+
2635 // Create sync directory if it doesn't exist
2736 File (syncDir).mkdirs()
2837
@@ -77,6 +86,7 @@ class SyncInterface(context: Context) {
7786 val handler = Handler (Looper .getMainLooper())
7887
7988 executor.execute {
89+ Log .i(TAG , " Starting sync operation: $operation " )
8090 try {
8191 val response = syncFn()
8292 val json = JSONObject (response)
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ class SyncScheduler(private val context: Context) {
1717 if (isRunning) {
1818 performSync()
1919 // Schedule next sync in 15 minutes
20+ Log .i(TAG , " Scheduling next sync in 15 minutes" )
2021 handler.postDelayed(this , 15 * 60 * 1000L )
2122 }
2223 }
You can’t perform that action at this time.
0 commit comments