Android EPUB 意图
假设我想做以下事情:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/epub");
目前我很难找到一个具有 epub 过滤器设置的应用程序,并且想知道是否有人有任何想法。
我的目的是在外部应用程序中加载 epub 文件,该文件将从我的应用程序启动。尝试使用 Aldiko,但它似乎没有为此设置任何过滤器。
Say I want to do the following:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/epub");
At the moment I'm having a tough time finding an app out there that has a filter setup for epub, and was wondering if anyone has any ideas.
My intent is to load an epub file in an external application, which will be initiated from mine. Tried using Aldiko, but it doesn't seem to have any filters setup for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试
似乎对我有用。 mime 类型尚未正式http://en.wikipedia.org/wiki/EPUB
这对我和阿尔迪科有用。
Try
seemed to work for me. The mime type is not official (yet) http://en.wikipedia.org/wiki/EPUB
this worked for me with Aldiko.
您可以使用 Context.startActivity(Intent) 使用 Intent 来启动特定应用程序。它会抛出“ActivityNotFoundException”异常,您可以捕获该异常并尝试启动另一个支持 epub 的应用程序,等等。
您可以在向用户显示错误之前定位一些最流行的应用程序,因此显然,您的应用程序必须提及至少其中一个应用程序的先决条件。
当然,这是一个丑陋的黑客行为,你应该避免这样做,但这可能对你有用,直到你找到更好的解决方案,即像 Aldiko 这样的应用程序引入了 epub 过滤器。
You may use an Intent to start a specific application using Context.startActivity(Intent). It throws "ActivityNotFoundException" exception which you can catch and try start another application that supports epub, and so on.
You can target some of the most popular apps before showing an error to the user, and so obviously, your app will have to mention a pre-requisite for at-least one of these apps.
Of-course this is a ugly hack and you should avoid doing this, but this may work for you till you find a better solution, ie apps like Aldiko introduce a epub filter.
似乎不存在适合我目的的外部应用程序。
所以,我的解决方案是编写自己的电子阅读器来解析 EPUB 文件以满足我的独特需求。
It doesn't seem like an external app exists for my purposes.
So, my solution is to write my own ereader to parse EPUB files for my unique needs.
Google Play 图书打开 application/epub+zip。但不是应用程序/epub。如果他们没有在 Google Play 图书设置中激活上传,则会失败。
Google play books opens application/epub+zip. But not application/epub. It will fail though if they have not activated uploads in google play books settings.