.pdf, an image viewer for .jpg. Your app doesnβt read the content. The function is not available on the web, so call it from a non-web source set such as nonWebMain (see shared source sets).
Usage
openFileWithDefaultApplication is a regular function, not a suspend function, so you can call it directly from a click handler. There is no Compose launcher.
Options
PlatformFile
required
The file to open. It must exist.
FileKitOpenFileSettings
default:"createDefault()"
Platform-specific settings.
Platform notes
Failures are reported differently on each platform. Only the JVM wraps some of them inFileKitDialogException:
Android setup
Only needed for files outsideFileKit.filesDir and FileKit.cacheDir. filekit-dialogs already ships a FileProvider (${applicationId}.FileKitFileProvider) that covers those two directories, and content:// files returned by the pickers need no provider at all. For any other location, such as getExternalFilesDir(), FileProvider throws an IllegalArgumentException until you declare your own provider.
1
Declare a provider in your manifest
AndroidManifest.xml
2
List the directories it may expose
Add one entry per location you use, for example app-specific external storage:See FileProvider for every path type.
res/xml/file_paths.xml
3
Pass the authority to FileKit
The
authority parameter exists only on Android, so build these settings in androidMain:androidMain
Related
- Share file to send a file to another app.
- File picker to let the user choose one.