最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Mime type of .fb2 files - Stack Overflow

programmeradmin7浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 1

According 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.

发布评论

评论列表(0)

  1. 暂无评论