From 667dda803345e295789175e8b0641ad838e984a3 Mon Sep 17 00:00:00 2001 From: Ishan09811 <156402647+Ishan09811@users.noreply.github.com> Date: Sat, 9 Mar 2024 11:49:53 +0530 Subject: [PATCH] done --- .../pandroid/app/main/SettingsFragment.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java index 1043ab869..b67792483 100644 --- a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java +++ b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/main/SettingsFragment.java @@ -29,15 +29,18 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S }); } - private void shareLogFile() { - // Share the log file - String filePath = "/storage/emulated/0/Android/media/com.panda3ds.pandroid/logs/current.txt"; - Uri uri = Uri.parse("file://" + filePath); - Intent intent = new Intent(Intent.ACTION_SEND); - intent.setType("text/plain"); - intent.putExtra(Intent.EXTRA_STREAM, uri); - startActivity(Intent.createChooser(intent, "Share Log File")); - } + private void shareLogFile() { + // Share The Log File + String filePath = "/storage/emulated/0/Android/media/com.panda3ds.pandroid/logs/current.txt"; + File file = new File(filePath); + Uri uri = FileProvider.getUriForFile(requireContext(), "com.panda3ds.pandroid.fileprovider", file); + + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_STREAM, uri); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + startActivity(Intent.createChooser(intent, "Share Log File")); + } private String getVersionName() { try {