Android - Build two version of the same app

327 views Asked by At

I'm developing an app for both Google Play and Amazon Store. And the markets have some difference, fox example: the link to download app page. Thus, my apks have a little diffrence. I don't want to replace all of them for every build/sign apk. Does anyone have a solution? Thanks for your helping!

2

There are 2 answers

1
Aelexe On

If you created two identical APK's but signed them using different keys, you could then use some code to determine what to display in the application based on the key signature.

Someone has done something similar here: Detect if app was downloaded from Android Market

2
Kumar Bibek On

For this particular issue with "Giving a rating option",

You can have the same build with conditional branches, which detects if a device is an amazon device or not.

if (Build.MANUFACTURER.contains("Amazon"){
    // Show amazon store page
} else {
    // Show google page 
}

If you are also building for Samsung store, then it gets a little tricky, because, you would then want to know if your build has been installed through the Samsung store or the Play store.

For that, you will need 2 different builds.

Or you can use the new API, that tells you who installed the app. (from @Aelexe's link to another question)

http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstallerPackageName%28java.lang.String%29