I would like to be able to open a file picker for .fb2
files, but I am not able to find the mime type.
val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.OpenDocument(),
onResult = { uri ->
handleEvent(ImportScreenEvent.Import(uri))
}
)
launcher.launch(
arrayOf(
"application/pdf",
"text/plain",
"application/epub+zip",
"text/fb2+xml",
"application/x-fb2",
"aapplication/x-zip-compressed-fb2",
"application/fb2+zip",
"application/fb2.zip",
"application/fb2",
"application/fictionbook2+zip",
"application/fictionbook3+zip"
)
)
I would like to be able to open a file picker for .fb2
files, but I am not able to find the mime type.
val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.OpenDocument(),
onResult = { uri ->
handleEvent(ImportScreenEvent.Import(uri))
}
)
launcher.launch(
arrayOf(
"application/pdf",
"text/plain",
"application/epub+zip",
"text/fb2+xml",
"application/x-fb2",
"aapplication/x-zip-compressed-fb2",
"application/fb2+zip",
"application/fb2.zip",
"application/fb2",
"application/fictionbook2+zip",
"application/fictionbook3+zip"
)
)
Share
Improve this question
asked Mar 14 at 22:06
BPDevBPDev
9177 silver badges22 bronze badges
1 Answer
Reset to default 1According to Wikipedia, your latter two (application/fictionbook2+zip
and application/fictionbook3+zip
) are valid MIME types. However, Android only knows of a small subset of the possible MIME types and their file extension associations Requesting MIME types outside of that subset will not work and will give you the results that you see in your question. There is nothing that you can do about this.