Implementing the same feature on two app versions - android

I have two versions of an app (paid and free). When I add a new feature in both versions I have to write the same code on both of them. Is there a way to write the code on one of them and then add automatically on the other? Or at least set a point from which to start marking the code lines changed to add it later on the other version?

I would create an Android app that will act as a core. Both the paid and the free apps would use it. Everything that's using the same code should be moved into the core app and only the differences should remain in the free and the paid apps, respectively.

Related

How to manage free and paid versions of an Android project?

I decided to build a paid version of my free Android application.
The paid version has some extra features. How do I manage both versions?
Is it possible to keep them based on the same source code?
If an application requires unique package name, how do I force paid application to replace free version?
What about db, preferences and other privately stored stuff, how to share them without exposing all data to the rest of the world?
Any advice that will help to manage both projects,
but not answers the above questions directly, is appreciated as well.
There are several approaches:
Put the core of your app in a library project, and create two other projects one for the paid, and one for the free version of the app. An upgrade to the paid version means the user has to uninstall the free version, and looses all the data.
This is the "classical" approach.
Let the user make an in-app payment. The user keeps all database and settings, and you have to maintain only one app.
This option requires extra modules to be included in your app, and extra logic.
Make another dummy/empty app, this is a paid app. The existance of this app means the user has a paid version. The user keeps on using the orginal/free app.
You can simply check by using the PackageManager to see if the paid app is downloaded.
The user keeps all database and settings, and you have to maintain only one app. Ok, there are two apps, but the second can be really small and simple.
You don't have to include additional libraries/code to make an in-app payment. You can also have all your apps upgraded to the 'pro' version with one purchase.
I don't know if all users understand this pattern. For the developper, this can be achieved with minimal work, and the users keep all their settings while upgrading.
I think it's possible and recommended to keep them in same source
code. Otherwise you have to support two versions of app instead of
only one.
If you have only one app therefore you have only one package name.
Create a class responsible for app features availability in current license state (free or paid). This class should store information about license state (free, paid, maybe you will deside to add subscription mode in future in which paid version can expire after some period). Features of your app available only in paid verion shoud check current license state. You can also change app GUI depending of license state. For example hide GUI of paid features, show "Buy" button or ads, etc.
And also if you have only one app that can be free or paid you don't have to share any internal app data between paid and free versions.

Publishing two versions of the same application, optimized for different handsets, as an update

I am in a situation where I have to publish two variants of the same application which are optimized for different devices (one for a specific HTC, other for all the other devices)
I want to be able to publish both the apps specifying which one is compatible with which device.
Is it something that I'll be controlling with the Manifest file?
If yes, then how!?
The typical scenario is, I have a separate version for HTC Inspire 4G, and another version for every other phone.
How do I upload these two to the market when:
The app is supposed to be an upgrade
The app is a fresh upload
Is the only difference in the interphases? You could probably combine the projects using alternate layouts.
If you absolutely MUST have two separate apps, I think you may have to copy the contents of your project over to a new file, since the android market won't allow you to publish multiple apps with the same package name (it will stop you from uploading any app witht the same namespace and ask you to upgrade the first app instead).
I think your only options are to somehow combine the code into one app that distinguishes between the devices internally somehow, or to create two completely seperate projects, and publish them under similar names.
Unfortunately, each application on market must have unique package. So you are out of luck to upgrade single application to different ones depending on device.
I'd suggest that you make accommodations for Inspire 4G in your code. I suspect that differences are not that significant to warrant two applications.

Upload two similar applications to Android Market

I want to upload the same application twice to the Android Market. One version will have AdMob messages and the other version of the same app will cost a pair of bucks.
Should I make two applications with differents packages names in order to upload them or is there any trick to do it with the same project.
Thanks in advance.
Every application at Android Market must have unique package name, so you have to place your apps into different packages (one be a subpackage of another though, i.e. com.app and com.app.ads). You can share common code in a library project.
You will need two different package names. You might also consider to exclude certain parts of your code in your free version, because Android Market is known for not being the most secure distribution channel. But if the only difference is the additional ads in your free version, it is not worth the effort.
There is another possibility, which unfortunately, I don't know how to do, but I'd like to find out. You can put all the functionality into one app and then create a second app which acts as a "key". Users download your first app for free, but it has limited functionality unless the "key" app is also present. You would charge users to download the "key" app.
This solution has the advantage of not having to maintain two code bases for every app, which is what I do and it drives me nuts.

Android minSdkVersion

I've programmed my app with Eclipse and android 2.2. However I think that my app would work for previous version and so it would allow more users to use my app. The problem is that I'm not sure... for instance I'm using Gestures which I think is a more recent feature... but otherwise I'm just using some Button, ListView, and WebView.
So is there a way to detect automatically the Minimum Sdk Version needed ( by checking which function my app is using) ?
I can't download the SDK of each previous version of android and test it until it doesn't work ...
Thanks
I can't download the SDK of each previous version of android and test it until it doesn't work ..
Why cant you? This is what the rest of us do. Create various different Emulators and test it out. I've released many apps by testing this way.
Take a look at the Compatibility page on Android's developer website.
It has some great information on how to make sure your application will work on different versions of Android and how to stop users from downloading the application if they do not have the right features on their device. In your case that would be the gestures feature.
To manage this, Android defines
feature IDs. Every capability has a
corresponding feature ID defined by
the Android platform. For instance,
the feature ID for compass is
“android.hardware.sensor.compass”,
while the feature ID for Live
Wallpapers is
“android.software.live_wallpapers”.
Each of these IDs also has a
corresponding Java-language constant
on the PackageManager class that you
can use to query whether feature is
supported at runtime.
To be totally sure you have to test your app against every platform version you target. Otherwise users of your app will do it for you (and that might be not good for app rating).
On the https://developer.android.com/about/dashboards/index.html page you can see the latest up-to-date platforms share info. So just decide how many potential users you're going to leave without your app :)

Splitting android application in to two 'branches', free and paid

I've developed an android-application that I'dd like to put up on the marketplace. However, I want to split it into two separate applications, one free (with ads), and one paid (logically without ads). How would I go about doing that? I'm not wondering about adding ads (I've alreaddy managed that), but how to take one existing android-application (eclipse-project) and split it into two without having to create a new project and just copy-paste every file one by one (or in batch for that matter). Is that possible?
Btw, I use GIT for SCM, so I've made two separate branches, one master and one free, but I need to set some cind of config-value that makes shure that the market separates them as two different applications.
Also, when a user 'upgrades', is it possible to copy the db from the free app to the paid one?
You could use the Maven Android Plugin to build multiple versions of the same application. You could then specify a different AndroidManifest for each version (in order to specify a different Application Package Name for each version).
Your free and paid version of your app would be different profiles in Maven.
For your second question, don't you use the device's database? If so, you can access it at '/data/data/free_app/databases/' and copy it over to /data/data/paid_app/databases/ .
Or even use the same package name for the apps, and make both use the same database. You'll have to make the free one uninstall itself when the otehr is bought so the data doesn't get weird.
See here in case you use an app database.
you could do in app payments to make the upgrade to paid version, it'd be neat because you'd have everything on just one project

Categories

Resources