Search code examples
androidgoogle-analyticsgoogle-playandroid-install-apkcampaign-monitor

Make sure the Android application was installed from Play-Store


I've recently discovered the BlackMarket application, it is a rip of Google Play-Store apps, where these people take a paid app from the Play-Store and let their users download it and use it for free.

As a developer which plan on charging a buck for my app, this bothers me, and I would like to make sure that my application was installed via the Play-Store, or whatever store I approve of.

I guess that the only way to verify this sort of thing is via the campaign tracking, but since Google analytics v2, the tracking of the campaign is done with in a receiver in the Jar.

Is there any other way to determine the origin of the installation of my app? Is there a way to intercept the campaign tracking data?

Thanks.


Solution

  • Check this link here. Then

    PackageManager pm = getPackageManager();
    String installationSource = pm.getInstallerPackageName(getPackageName());
    

    When installed from the marked, the installationSource will return something like com.google.android% or com.android.vending%. However this changes and you have to maintain (support) it in case of a change - otherwise it will return null (from debugger) or some other package name, from some other application (the undesired ones :))