From 43838a5e892e5d8cdf17f132d19a39de6db6c490 Mon Sep 17 00:00:00 2001 From: Kovas Palunas Date: Mon, 19 Apr 2021 08:53:22 -0700 Subject: [PATCH] updated code to write to user-accessible external data directory UNTESTED. --- mobile/src/main/AndroidManifest.xml | 4 +++- .../src/main/java/net/activitywatch/android/RustInterface.kt | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index ed602ec6..4f4985c9 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -11,6 +11,8 @@ android:required="false" /> + + - \ No newline at end of file + diff --git a/mobile/src/main/java/net/activitywatch/android/RustInterface.kt b/mobile/src/main/java/net/activitywatch/android/RustInterface.kt index ddc9ab45..67ca8ef4 100644 --- a/mobile/src/main/java/net/activitywatch/android/RustInterface.kt +++ b/mobile/src/main/java/net/activitywatch/android/RustInterface.kt @@ -27,7 +27,8 @@ class RustInterface constructor(context: Context? = null) { initialize() if(context != null) { - setDataDir(context.filesDir.absolutePath) + // See https://developer.android.com/reference/kotlin/android/content/Context#getexternalfilesdir + setDataDir(context.externalFilesDir.absolutePath) } } @@ -114,4 +115,4 @@ class RustInterface constructor(context: Context? = null) { Log.w(TAG, getBucketsJSON().toString(2)) Log.w(TAG, getEventsJSON("test").toString(2)) } -} \ No newline at end of file +}