Question

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.

Was it helpful?

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 :))

OTHER TIPS

The best way I've found to know if an app is from Play Store is what g00dy suggested: using the installer package name.

String packageName = appContext.getPackageName();
String installerPackage = appContext.getPackageManager().getInstallerPackageName(packageName);

if the app is downloaded in Play Store (even if the app is bought with a PC), installerPackage should be "com.vending.google".

I found this http://developer.android.com/google/play/licensing/licensing-reference.html#lvl-summary

public boolean allowAccess() {
    long ts = System.currentTimeMillis();
    if (mLastResponse == LicenseResponse.LICENSED) {
        // Check if the LICENSED response occurred within the validity timeout.
        if (ts <= mValidityTimestamp) {
            // Cached LICENSED response is still valid.
            return true;
        }
    } else if (mLastResponse == LicenseResponse.RETRY &&
                ts < mLastResponseTime + MILLIS_PER_MINUTE) {
        // Only allow access if we are within the retry period or we haven't used up our
        // max retries.
        return (ts <= mRetryUntil || mRetryCount <= mMaxRetries);
    }
    return false;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top