Android 应用程序版本(免费和付费)- 告诉图书馆项目类应用程序是免费还是付费
我有一个 Android 应用程序项目,其中包含我的所有代码。我已经将这个“应用程序”作为定义的库项目 这里在 android. Developer.com。。
因此,我创建了两个利用这个库项目的新 Android 项目。每个新项目的新包名称是:
com.myapps.freeapp
com.myapps.paidapp
正如您可能看到的,我正在尝试发布该应用程序的免费和付费版本。
告诉图书馆项目所安装的应用程序是免费版本还是付费版本的最佳方法是什么?
I have an Android app project that contains all of my code. I've made this "app" a Library project as defined here at android.developer.com..
Consequently, I have made two new Android projects which utilize this library project. The new package names for each of the new projects are:
com.myapps.freeapp
com.myapps.paidapp
As you can probably see, I am trying to publish free and paid versions of the app.
What is the best way to tell the library project whether the installed app is the free version or paid version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是来自我的博客文章 描述了如何使用库项目构建免费/付费版本。
一般来说,您将创建三个项目;一个免费项目、一个付费项目和一个图书馆项目。
然后,您将在库项目中创建一个 Build.java 文件,如下所示:
现在,您将在每个项目中创建一个 build.xml 资源:
[library]/resources/values/build.xml:
[free] /resources/values/build.xml:
[付费]/resources/values/build.xml:
然后您将能够在运行时检查版本:
博客文章详细介绍了所需的确切步骤在 Linux 命令行中从头开始创建项目。
This is from my blog post that describes how to build a free / paid version using a library project.
Generally, you'll create three projects; a free project, a paid project and a library project.
You'll then create a Build.java file in your library project such as this:
Now, you'll create an build.xml resource in each of your projects:
[library]/resources/values/build.xml:
[free]/resources/values/build.xml:
[paid]/resources/values/build.xml:
You will then be able to check for the version at run time:
The blog post details the exact steps necessary to create the projects from scratch at the Linux command line.
“付费”和“免费”信息取决于每个应用程序,而图书馆并不知道此类信息。
如果您有一些依赖于这些应用程序的特定代码(例如,检查许可证的代码),那么它应该位于特定应用程序中,而不是位于两者共同的部分中。
The "paid" and "free" informations are dependant on each application -- and the library doesn't know such informations.
If you have some specific code that depends on those applications (i.e. code to check for the licence, for example), it should be in the specific applications, and not in the part that's common to both.