fipesa
Last Updated: February 25, 2016
·
2.117K
· javipacheco
A34cd2eb871371b5539bc489f7d086b9

Check if an APK is from Google Play

With this method you can check if an APK was installed from Google Play

private boolean isFromGooglePlay(String pName) {
    PackageManager packageManager = this.getPackageManager();
    String installPM = packageManager.getInstallerPackageName(pName);
    if ( installPM == null ) {
        // Definitely not from Google Play
        return false;
    } else if ( installPM.equals("com.google.android.feedback") ) {
        // Installed from the Google Play
        return true;
    }
    return false;
}

More information: http://androidcracking.blogspot.com.es/2011/01/anti-cracking-example.html

Say Thanks
Respond

3 Responses
Add your response

617
4cuvt4ro

I thought this was more difficult and it was necessary to use the Android Licensing Library:

http://developer.android.com/guide/google/play/licensing/index.html

Good tip!

over 1 year ago ·
685
0c80b07

Cool!, this tip will be very useful for the new version of 'My App List'.

Thanks!

over 1 year ago ·
722
0c80b07

Javi in my Asus Transformer, the returned InstallerPackageName is "com.android.vending". I had to add:

else if (installPM.equals("com.android.vending") ) {
    return true;
}
over 1 year ago ·