diff --git a/android/app/src/main/java/mw/gri/android/MainActivity.java b/android/app/src/main/java/mw/gri/android/MainActivity.java index a589934..2324e10 100644 --- a/android/app/src/main/java/mw/gri/android/MainActivity.java +++ b/android/app/src/main/java/mw/gri/android/MainActivity.java @@ -450,14 +450,14 @@ public class MainActivity extends GameActivity { // Pass image from camera into native code. public native void onCameraImage(byte[] buff, int rotation); - // Called from native code to share image from provided path. - public void shareImage(String path) { + // Called from native code to share data from provided path. + public void shareData(String path) { File file = new File(path); Uri uri = FileProvider.getUriForFile(this, "mw.gri.android.fileprovider", file); Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, uri); - intent.setType("image/*"); - startActivity(Intent.createChooser(intent, "Share image")); + intent.setType("*/*"); + startActivity(Intent.createChooser(intent, "Share data")); } // Called from native code to check if device is using dark theme. diff --git a/android/app/src/main/res/xml/paths.xml b/android/app/src/main/res/xml/paths.xml index db42735..f1b8553 100644 --- a/android/app/src/main/res/xml/paths.xml +++ b/android/app/src/main/res/xml/paths.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/src/gui/platform/android/mod.rs b/src/gui/platform/android/mod.rs index 01565b9..135d010 100644 --- a/src/gui/platform/android/mod.rs +++ b/src/gui/platform/android/mod.rs @@ -144,7 +144,7 @@ impl PlatformCallbacks for Android { let default_cache = OsString::from(dirs::cache_dir().unwrap()); let mut file = PathBuf::from(env::var_os("XDG_CACHE_HOME").unwrap_or(default_cache)); // File path for Android provider. - file.push("images"); + file.push("share"); if !file.exists() { std::fs::create_dir(file.clone())?; } @@ -159,7 +159,7 @@ impl PlatformCallbacks for Android { let vm = unsafe { jni::JavaVM::from_raw(self.android_app.vm_as_ptr() as _) }.unwrap(); let env = vm.attach_current_thread().unwrap(); let arg_value = env.new_string(file.to_str().unwrap()).unwrap(); - let _ = self.call_java_method("shareImage", + let _ = self.call_java_method("shareData", "(Ljava/lang/String;)V", &[JValue::Object(&JObject::from(arg_value))]); Ok(())