Wrong name of the shared file when choosing the app from Intent.createChooser

119 views Asked by At

My app can share internally stored files with the androidx.core.content.FileProvider. The intent and the chooser are created with the following snippet:

val shareIntent: Intent = Intent().apply {
    action = Intent.ACTION_SEND
    putExtra(
        Intent.EXTRA_STREAM,
        FileProvider.getUriForFile(this, authority, file, displayName),
    )
    type = document.mimeType.mediaType
}
startActivity(Intent.createChooser(shareIntent, getString(R.string.share_title)))

I explicitly pass the displayName to the FileProvider, but in the app chooser, I see the file's local name (see image).

Intent.createChooser

Is there a way to show the correct display name in the chooser?

0

There are 0 answers