pub struct FileOpener<'a, R: Runtime> { /* private fields */ }
Expand description
API of opening file/dir with other apps.
§Examples
fn example(app: &tauri::AppHandle) {
use tauri_plugin_android_fs::AndroidFsExt as _;
let api = app.android_fs();
let file_sender = api.file_sender();
}
Implementations§
Source§impl<'a, R: Runtime> AsyncFileOpener<'a, R>
impl<'a, R: Runtime> AsyncFileOpener<'a, R>
Show app chooser for sharing files with other apps.
This function returns immediately after requesting to open the app chooser,
without waiting for the app’s response.
This sends the files as a single unit.
The available apps depend on the MIME types associated with the files.
This does not result in an error even if no available apps are found.
An empty app chooser is displayed.
§Args
- uris :
Target file URIs to share.
This all needs to be readable.
URIs converted directly from a path, such as viaFileUri::from_path
, can not be used.
§Support
All Android version.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_SEND_MULTIPLE https://developer.android.com/reference/android/content/Intent#ACTION_SEND
Show app chooser for sharing file with other apps.
This function returns immediately after requesting to open the app chooser,
without waiting for the app’s response.
The available apps depend on the MIME type associated with the file.
This does not result in an error even if no available apps are found.
An empty app chooser is displayed.
§Args
- uri :
Target file URI to share.
Must be readable.
URIs converted directly from a path, such as viaFileUri::from_path
, can not be used.
§Support
All Android version.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_SEND
Sourcepub async fn open_file(&self, uri: &FileUri) -> Result<()>
pub async fn open_file(&self, uri: &FileUri) -> Result<()>
Show app chooser for opening file with other apps.
This function returns immediately after requesting to open the app chooser,
without waiting for the app’s response.
The available apps depend on the MIME type associated with the file.
This does not result in an error even if no available apps are found.
An empty app chooser is displayed.
§Args
- uri :
Target file URI to view.
Must be readable.
URIs converted directly from a path, such as viaFileUri::from_path
, can not be used.
§Support
All Android version.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_VIEW
Sourcepub async fn open_dir(&self, uri: &FileUri) -> Result<()>
pub async fn open_dir(&self, uri: &FileUri) -> Result<()>
Show app chooser for opening dir with other apps.
This function returns immediately after requesting to open the app chooser,
without waiting for the app’s response.
This does not result in an error even if no available apps are found. An empty app chooser is displayed.
§Args
- uri :
Target dir URI to view.
Must be readable.
URIs converted directly from a path, such as viaFileUri::from_path
, can not be used.
§Support
All Android version.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_VIEW
Sourcepub async fn edit_file(&self, uri: &FileUri) -> Result<()>
pub async fn edit_file(&self, uri: &FileUri) -> Result<()>
Show app chooser for editing file with other apps.
This function returns immediately after requesting to open the app chooser,
without waiting for the app’s response.
The available apps depend on the MIME type associated with the file.
This does not result in an error even if no available apps are found.
An empty app chooser is displayed.
§Note
I think that this may be the least commonly used request for sending file to app.
Even if you want to open an image or video editing app,
FileOpener::open_file
allows you to choose from a wider range of apps in many cases.
§Args
- uri :
Target file URI to view.
Must be read-writeable.
URIs converted directly from a path, such as viaFileUri::from_path
, can not be used.
§Support
All Android version.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_EDIT