扩展在不同的APK我的Andr​​oid应用程序 [英] Extend my android app in different APK

查看:120
本文介绍了扩展在不同的APK我的Andr​​oid应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发应该是可扩展的应用程序 我希望用户安装基础的应用程序,然后通过安装扩展包(不同的APK)或插件来扩展它(如GO桌面和主题包装或附加部件)

I am developing an application that should be extendable I want the user to install the base app and then extend it by installing extension packs (different APKs) or plug-ins (like go launcher and theme-packs or add-on widgets)

我唯一能找到的就是使用库项目共享code,但不适合我的需要。有人可以解释它是如何做的?

The only thing I could find is using library project to share the code but that doesn't fit my needs. Can someone explain how its done?

更具体地讲,这里就是我想要做的: 我有一组动画场景,特效和转场 动画场景是code和资源的组合 用户可以选择第一现场,第二场面等。

[edit] To be more specific, here is what I want to do: I have a set of animated scenes, effects and transitions animated scene is a combination of code and resources The user can select the 1st scene, 2nd scene etc..

我希望能够增加更多的场景,但我不想将它们包括在同一个APK 我想,让用户下载自己所选择的场景。

I wish to be able to add more scenes but I don't want to include them all in one APK I want to let the user download scenes of his choice.

推荐答案

要建立这种类型的交互,的ContentProvider 将成为你的朋友。有两个选择,我能想到的建立这种类型的系统,这取决于你的方向等的信息流动。

To build this type of interaction, ContentProvider will be your friend. There are two options I can think of to build this type of system, depending on which direction you would like information to flow.

选项1:单一的ContentProvider在主应用程序

定义的ContentProvider 在主应用程序,这为其他应用程序的读/写数据到一个共同的位置上的外部接口。该供应商保持访问现场数据文件/数据库应用程序的需要。

Define a ContentProvider in your main application, which creates an external interface for other applications to read/write data to a common location. This provider maintains access to the scene data files/database your application needs.

每个随后的插件应用程序访问的主要的ContentProvider(也向用户发出警告,如果他们运行一个插件,但没有安装主应用程序还),并通过将其写入的ContentProvider <安装其具体内容/ code>。在这种方式中,每个插件设计用来充当安装,这意味着用户必须下载并运行从市场插件安装场景内容

Each subsequent plugin application accesses the main ContentProvider (and also warns the user if they run a plugin but haven't installed the main app yet) and installs its specific content by writing it to the ContentProvider. In this way, each plugin is designed to act as an "installer", meaning the user has to download and run the plugin from Market to install the scene content.

选项2:每个插件应用程序都有自己的ContentProvider

这个选项是上面的正好相反。定义的ContentProvider 在每个插件应用程序一致的界面,并有从该扫描系统的新插件(这可以通过 PackageManager ),并读取每个供应商的数据到其主要的本地存储。

This option is the reverse of the above. Define a ContentProvider with a consistent interface in each plugin application and have a method from the main application that scans the system for new plugins (this can be done via PackageManager) and reads the data from each provider into its main local store.

这里的不同之处在于,用户将不必运行各插件包,因为主要的应用程序将需要获取数据的照顾。然而,有更多的定义多个供应商的复杂性。举例来说,你必须确保,即使每个供应商都有相同的基本接口,他们不能有一个共同的权威,因此你必须扫描系统中的你自己喜欢的包名和解决基于这些信息的提供者

The difference here is that the user won't have to run each plugin package, because the main application will take care of getting the data. However, there's more complexity in defining multiple providers. For instance, you have to make sure that, even if each provider has the same basic interface, they cannot have a single common authority, so you will have to scan the system for package names like your own and resolve the providers based on that information.

编辑

说了这么多,我觉得我应该说我不相信这是将内容提供给用户的一个好方法。我对这个问题个人感觉这个方法污染了用户的设备与做他们没有很好的应用程序图标,这是难以掩饰那种事的移动设备上。一个简单和更清洁的方法,这将是存储你的附加的内容在服务器上(AWS服务,如S3和SimpleDB的实际上是免费的),并使用像谷歌的应用内结算服务,让用户购买新的内容,并直接下载到单一的应用程序,而不是让他们回到市场,并购买更多的应用程序。

Having said that, I feel I should mention that I don't believe this is a good method of providing content to your users. My personal feeling on the subject is this method pollutes the user's devices with application icons that do them no good, and it's difficult to hide that kind of thing on the mobile device. A simpler, and much cleaner approach to this would be to store your "add-on" content on a server (AWS services like S3 and SimpleDB are practically free) and use a service like Google's In-App Billing to let your users purchase the new content and download it directly into the single application rather than having them go back to Market and purchase more apps.

希望帮助!

这篇关于扩展在不同的APK我的Andr​​oid应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆