2

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!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Justin
  • 4,400
  • 2
  • 32
  • 36
  • 1
    More specifics would help us answer your question properly. – Kumar Bibek Jan 10 '14 at 03:23
  • For eaxample: My app have "Rate" feature, when user click "OK" button to go to merket (Google or Amazon), if they downloaded my app from Google Play, it'll re-direct them to Play Store, otherwise, Amazon. So i need two apk with the same release-keystore but it have a little difference. – Justin Jan 10 '14 at 04:10

2 Answers2

1

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

Community
  • 1
  • 1
Aelexe
  • 1,216
  • 3
  • 18
  • 27
  • Thanks for your helping! I just use one release-keystore. Currently, i use "Switching Android config build with ant" from this artical: [link](http://blog.blundell-apps.com/switching-android-configurations-using-constants-and-ant/), but i'm looking for a better solution. – Justin Jan 10 '14 at 04:33
1

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

Kumar Bibek
  • 9,016
  • 2
  • 39
  • 68
  • Use Build.MANUFACTURER is impossible cause by Google-power devices (ex: Nexus 4, or Galaxy S4) also can download apps from Amazon Store. I'm using Build.MANUFACTURER for check if device is Kindle or Google-power to process in-app-billing (in-app-purchsing), but i tired of changing code and use so more logical if...else. – Justin Jan 10 '14 at 04:38
  • In that case, what you need is the second option. (Detecting the installer package). But, personally, if a user is on a non-amazon device, I wouldn't mind him navigate my Play Store page. He might leave a good rating which would improve the overall visibility of my app. – Kumar Bibek Jan 10 '14 at 04:50