In my Android app I wanted to check the source of app installation. I looked at the Android documentation and found the following API as part of the PackageManager class:
I tested this API method with both emulator and real devices.
Most of the time, it returns null. Only return com.android.vending when the app is installed from official Google Play.
With China local app market apps, such as AppChina and wandoujia, null is returned.
Code snippet and log is posted here: Github Gist