在 Android 中维护专业版和免费版
我注意到市场上有很多应用程序有两个版本。一种免费,一种付费,具有扩展选项并且通常无广告。
我正在考虑在项目中制作类似的东西,但是维护这两个版本的最佳技术是什么?我假设在 eclipse 中使用 2 个 android 项目并手动更改它们是昂贵且容易出错的
提前致谢
I have noticed there is a lot of apps in the market with 2 versions. One free and one paid with extended options and adfree typically.
Im considering make something similar with a project but, whats the best technique for maintain both versions? I suppouse using 2 android projects in eclipse and manually change them is expensive and error-prone
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
制作应用程序的一个版本,并使用从某些捆绑资源文件中读取的属性来确定它是免费版本还是付费版本。例如,在构建付费版本时,您只需设置如下内容:
...对于免费应用程序,可能类似于:
然后作为初始化代码的一部分,您可以从文件/资源中获取此属性,并将其设置为系统属性。然后其余的代码就可以这样做:
因此,您拥有一个项目和一个代码库,而不是两个单独的项目,可以用来构建两个不同的工件。
Make one version of the app, and use properties that you read from some bundled resource file to determine whether it's the free version or the paid version. For instance, when building the paid version, you just set something like:
...and for the free app maybe something like:
And then as part of your initialization code you could fetch this property from the file/resource, and set it as a system property. And then the rest of you code can just do:
So instead of two separate projects, you have a single project and a single codebase that you use to build two different artifacts.
您可以在应用程序中硬编码一个常量值,例如
boolean isPro
。if (this.isPro)
,您可以允许其他功能或不显示添加。然后,当您准备好将应用程序上传到 android Market 时,只需创建两个 - 一个将isPro
指定为false
,另一个指定为true
>。You can have a constant value hardcoded in your app, such as
boolean isPro
.if (this.isPro)
, you can allow other features or not show adds. Then, when you are ready to upload your apps to the android Market, just create two - one withisPro
assigned tofalse
, the other totrue
.