我们如何知道APK安装源

How do we know about APK install source

I came to know that, Android Play Store is not only a place where we can deploy APK files and there are quite a few.

Now I am planning to deploy my APK on following:

  1) Amazon AppStore
  2) Opera Mobile Store
  3) Samsung Apps Store
  4) NokiaX.
  5) Android Play Store (Already deployed, also tracking)

Now the question is How to I know the source of installs of my App?

I wanted to see, if the app is installed from the Android Play Store, Amazon Appstore, Opera Mobile Store or Samsung Apps store etc ....

The below link may help for Amazon App installs:

Android install source

Any help is appreciated.

There is no API for that. You cannot know if apk is sideloaded or installed from store. Not 100% sure if some of stores have some kind of client database for that but not all stores are having it.

for android, we have to add receiver in Manifest file. For Amazon, I guess, it is the same way based as the link specified above. I also need to know about the other stores as well. Any way thanks for your input.

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

wow! that's great option. Thanks very much. With this I can track flavors on Google Analytics. I will give a try.