Open ecmel opened 3 months ago
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)
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.
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
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.
@flapili While searching for a solution I bumped into https://stackoverflow.com/questions/42213316/how-to-share-file-in-android Not tried yet but can be a simple solution for file sharing.
Also, the following capacitor plugins can be relevant:
https://github.com/ionic-team/capacitor-plugins/tree/main/share https://github.com/capacitor-community/file-opener
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.