将多个应用程序捆绑在一个应用程序中
我正在开发一个Android应用程序,它使用多个第三方应用程序,通过意图调用,例如第三方日历、网络广播等。因此,为了正确启动这些意图,需要安装这些应用程序。是否可以将这些 apk 包含在我的应用程序中,以便在设置我的应用程序时自动安装它们? 让用户手动安装这些应用程序似乎是一个非常糟糕的方法......
有什么建议吗?
谢谢 彼得
I am developing an android app which uses several third party apps, called by intents, e.g. a third-party calendar, webradio etc. So in order to start these intents correctly, these apps need to be installed. Is it possbile to include those apks in my app so that they are automatically installed as well when my app is setup ?
It seems to be quite a bad way to let the user install these apps manually...
Any suggestions ?
Thanks
Peter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能不是一个好主意。
对于初学者来说,这可能会侵犯版权,除非您得到那些开发人员的明确许可以这种方式捆绑。
然后,存在的问题是,这些开发人员是否确实公开了他们希望您以这种方式使用的 API,以及该 API 是他们独有的还是通用系统的一部分(例如,
ACTION_SEND)。用户应该能够安装他们想要的任何应用程序来满足通用
Intent
请求(例如,ACTION_SEND
),而不是被迫使用您指定的某些应用程序。并且您不应该集成到未公开记录且受支持的 API 或以其他方式表明它们对此类集成感兴趣的应用程序。然后,存在的问题是,如果这些应用程序最初不是通过某些标准分发服务(例如,Android Market)安装的,以后是否可以更新。
然后,所有这些 APK 文件都会使您自己的 APK 文件变得更大,从而占用设备上更多的空间。
如果你能克服这一切,那应该是可能的。将 APK 打包为资产,在第一次运行时将其复制到外部存储,然后使用右侧的
startActivity()
在其上启动ACTION_VIEW
Intent
MIME 类型。然而,这可能不是一个好主意。
理想情况下,您的应用程序不应该依赖于这些其他应用程序,因此用户是否拥有它们并不重要。您可以通过
PackageManager
和queryIntentActivities()
检测它们是否存在,然后使用它来确定是否要禁用应用程序的某些部分,或引导用户安装额外的应用程序等That's probably not a good idea.
For starters, it is probably a copyright violation, unless you have express permission from those developers to bundle this way.
Then, there is the question of whether those developers actually exposed an API that they are expecting you to be using this way, and whether that API is unique to them or is part of a generic system (e.g.,
ACTION_SEND
). Users should be able to install whatever applications they want that fulfill a genericIntent
request (e.g.,ACTION_SEND
) and not be forced to use some application you mandate. And you should not be integrating to applications that do not expose a documented and supported API or otherwise indicate that they are interested in such integration.Then, there is the question of whether or not those apps can later be updated, if they were not originally installed via some standard distribution service (e.g., Android Market).
Then, there is matter of all of those APK files making your own APK file that much larger, taking up that much more space on the device.
If you can get past all of that, it should be possible. Package the APKs as assets, copy them on first run to external storage, then launch an
ACTION_VIEW
Intent
on them viastartActivity()
using the right MIME type.However, again, this is probably not a good idea.
Ideally, your application should not depend upon these other applications, so it will not matter much whether the user has them or not. You can detect if they are there via
PackageManager
andqueryIntentActivities()
, then use that to determine if you want to disable parts of your app, or guide the user to install the extra applications, etc.