From dfc257007998c794dbfcca379d40d43379a53c9c Mon Sep 17 00:00:00 2001 From: Animesh Bohara Date: Wed, 1 Nov 2023 14:50:10 -0400 Subject: [PATCH] Use scoped storage instead of Downloads directory --- .../MLCChat/app/src/main/java/ai/mlc/mlcchat/AppViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/MLCChat/app/src/main/java/ai/mlc/mlcchat/AppViewModel.kt b/android/MLCChat/app/src/main/java/ai/mlc/mlcchat/AppViewModel.kt index f51d56ec10..6a760efde3 100644 --- a/android/MLCChat/app/src/main/java/ai/mlc/mlcchat/AppViewModel.kt +++ b/android/MLCChat/app/src/main/java/ai/mlc/mlcchat/AppViewModel.kt @@ -171,7 +171,7 @@ class AppViewModel(application: Application) : AndroidViewModel(application) { val url = URL("${modelUrl}${ModelUrlSuffix}${ModelConfigFilename}") val tempId = UUID.randomUUID().toString() val tempFile = File( - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), + application.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), tempId ) url.openStream().use {