保持Android的亲和免费版 [英] Maintain pro and free version in Android

查看:118
本文介绍了保持Android的亲和免费版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到有一个在市场上有很多的应用程序有2个版本。一个自由和一个具有扩展选项和adfree通常支付。

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.

林考虑做一个项目类似的东西,但是,什么对维护两个版本最好的技术?我suppouse使用日食2机器人项目,并对其进行手动更改价格昂贵,而且容易出错。

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

在此先感谢

推荐答案

使应用程序的一个版本,那你一些资源捆绑文件中读取,以确定它是否是免费版或付费版使用特性。例如,建立付费版本时,您只需设置是这样的:

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:

com.myapp.version=paid

...和免费的应用程序,也许是这样的:

...and for the free app maybe something like:

com.myapp.version=free

然后作为你的初始code部分,你可以从文件中取出/资源此属性,并将其设置为系统属性。然后,你休息code能只是做:

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:

if ("paid".equals(System.getProperty("com.myapp.version"))) {
    //allow access to paid functionality
}
else {
    //nag the user to get the paid version
}

因此​​,而不是两个单独的项目,你有一个单一的项目和用于构建两个不同的文物单个codeBase的。

So instead of two separate projects, you have a single project and a single codebase that you use to build two different artifacts.

这篇关于保持Android的亲和免费版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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