- // Create an intent to open a chooser based on the file chooser parameters.
- val fileChooserIntent = fileChooserParams.createIntent()
-
- // Check to see if the file chooser intent resolves to an installed package.
- if (fileChooserIntent.resolveActivity(packageManager) != null) { // The file chooser intent is fine.
- // Launch the file chooser intent.
- browseFileUploadActivityResultLauncher.launch(fileChooserIntent)
- } else { // The file chooser intent will cause a crash.
- // Create a generic intent to open a chooser.
- val genericFileChooserIntent = Intent(Intent.ACTION_GET_CONTENT)