pub struct FileSender<'a, R: Runtime>(/* private fields */);
Expand description
API of sharing files 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> FileSender<'a, R>
impl<'a, R: Runtime> FileSender<'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.
Files inPrivateStorage
cannot be used.
§Support
All.
§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.
Files inPrivateStorage
cannot be used.
§Support
All.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_SEND
Sourcepub fn open_file(&self, uri: &FileUri) -> Result<()>
pub 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.
Files inPrivateStorage
cannot be used.
§Support
All.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_VIEW
Sourcepub fn edit_file(&self, uri: &FileUri) -> Result<()>
pub 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,
FileSender::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.
Files inPrivateStorage
cannot be used.
§Support
All.
§References
https://developer.android.com/reference/android/content/Intent#ACTION_EDIT
👎Deprecated: Since Android 11, This does not function correctly due to android security.
Determines whether the specified files can be used with FileSender::share_files
.
If no app is available to handle the files, this returns false.
§Args
- uris :
Target file URIs to share.
This all needs to be readable.
§Support
All.
👎Deprecated: Since Android 11, This does not function correctly due to android security.
Determines whether the specified file can be used with FileSender::share_file
.
If no app is available to handle the file, this returns false.
§Args
- uri :
Target file URI.
Must be readable.
§Support
All.
Sourcepub fn can_open_file(&self, uri: &FileUri) -> Result<bool>
👎Deprecated: Since Android 11, This does not function correctly due to android security.
pub fn can_open_file(&self, uri: &FileUri) -> Result<bool>
Determines whether the specified file can be used with FileSender::open_file
.
If no app is available to handle the file, this returns false.
§Args
- uri :
Target file URI.
Must be readable.
§Support
All.
Sourcepub fn can_edit_file(&self, uri: &FileUri) -> Result<bool>
👎Deprecated: Since Android 11, This does not function correctly due to android security.
pub fn can_edit_file(&self, uri: &FileUri) -> Result<bool>
Determines whether the specified file can be used with FileSender::edit_file
.
If no app is available to handle the file, this returns false.
§Args
- uri :
Target file URI.
Must be read-writeable.
§Support
All.