Assuming you use Gradle, you could use different product flavor for each store. You could create a resource file for each flavor and then on runtime you read a value of that resource to detech which flavor you are running. It only requires one additional resource XML file per flavor and defining those flavors in your build.gradle. Building your application wfter those modifications will result in 1 APK per store that are identical except for that one resource value.
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-flavors
Something like this... Add these to your build.gradle:
android {
productFlavors {
amazon {}
opera {}
samsung {}
nokiax {}
google {}
}
}
And the you add a resource file per flavor app/src/FLAVOR/res/values/store.xml (e.g. app/src/nokiax/res/values/store.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="store_identifier">nokiax</string>
</resources>
Now when you read the value of resource "store_identifier" you can detect which flavor you are running and thus deduce the store it was installed from. You might want to use integer resource instead of string though.
With those modifications building the app will result in 5 APK files (e.g. app_nokiax_release.apk, app_google_release.apk ...) and you can deploy each to their respective store