From 8884f80e4daa4be9f4110bc9ad189d14a6480d2d Mon Sep 17 00:00:00 2001 From: Lisheng Guan Date: Fri, 3 Jan 2025 18:40:52 +0800 Subject: [PATCH] Sync: resolver.notifyChange to prompt synchronization. --- .../money/manager/ex/core/docstorage/FileStorageHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/money/manager/ex/core/docstorage/FileStorageHelper.java b/app/src/main/java/com/money/manager/ex/core/docstorage/FileStorageHelper.java index 75015a37e..1b0477941 100644 --- a/app/src/main/java/com/money/manager/ex/core/docstorage/FileStorageHelper.java +++ b/app/src/main/java/com/money/manager/ex/core/docstorage/FileStorageHelper.java @@ -222,10 +222,12 @@ private void uploadDatabase(DatabaseMetadata metadata) { // Use Files.copy() for direct file-to-stream copy try (OutputStream outputStream = new FileOutputStream(pfd.getFileDescriptor())) { Files.copy(localFile.toPath(), outputStream); + // Notify resolver to ensure synchronization + resolver.notifyChange(remoteUri, null); Timber.d("Database stored successfully to %s", remoteUri); } } catch (FileNotFoundException e) { - Timber.e(e, "File not found during upload: %s", metadata.localPath); + Timber.e(e, "File not found during upload: %s, URI: %s", metadata.localPath, remoteUri); } catch (IOException e) { Timber.e(e, "IO error during upload: %s", metadata.localPath); }