Plugin Request: Share Files or Data #14554
Replies: 9 comments
-
|
Hi @ecmel , I would try to implement this Here we only speak about sending data rigth, not be the target ? The downside of Android's intent is the api can't be 1-1 to the web api, and the guest js should be the most platform agnostic I believe PS: there is no way to ensure the share worked, there is no standard about that, some application respond when the handling of the file is ok, some other when the file is valid, some other only respond with errror when it's invalid... And most app never respond 😅🥹 (but accept without any issue the file) |
Beta Was this translation helpful? Give feedback.
-
|
Hi @flapili thank you for your response, yes I am speaking about sending data not target. Specifically I need to share a pdf file stored in app data dir and view it in system's default pdf viewer or send by e-mail etc. For MacOS the shell open api works very well, for iOS web share api some what works but for android I could not find a way. |
Beta Was this translation helpful? Give feedback.
-
|
I'll try to take a look, but I'm clueless about path, I only found example when the file is sent as bytes not path What kind of spec / DX / final API would you like to have ? EDIT: found https://developer.android.com/reference/android/content/ContentUris |
Beta Was this translation helpful? Give feedback.
-
|
In fact https://beta.tauri.app/reference/javascript/shell/#open function works on desktop very well, on android I get the following error. This may be a purely device permission issue and may be easy to fix. |
Beta Was this translation helpful? Give feedback.
-
|
@flapili While searching for a solution I bumped into https://stackoverflow.com/questions/42213316/how-to-share-file-in-android |
Beta Was this translation helpful? Give feedback.
-
|
Also, the following capacitor plugins can be relevant: https://github.com/ionic-team/capacitor-plugins/tree/main/share |
Beta Was this translation helpful? Give feedback.
-
|
I have made a plugin for viewing files on mobile similar to shell open on desktop: https://github.com/ecmel/tauri-plugin-view |
Beta Was this translation helpful? Give feedback.
-
@ecmel Thank you for creating this plugin! 🙌 I’ve been struggling to find a solution for viewing files on mobile, and your plugin worked perfectly for my use case. It literally saved my app (https://apps.apple.com/in/app/simple-invoice-bill-maker/id6737187790) — couldn’t have shipped without it! |
Beta Was this translation helpful? Give feedback.
-
|
I found another plugin that offers text sharing on both Android and iOS: There is also a fork that adds file sharing and some tests: The code looks pretty simple. It would be nice if such a plugin could become an official part of |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Web Share API is not available for android https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API and shell open does not work with file paths on mobile.
We need a way to make the mobile app share files or data.
Beta Was this translation helpful? Give feedback.
All reactions