You should not use PackageManager#getInstallerPackageName to check if the application is installed from Google Play or for licensing purposes for the following reasons:
1) The packagename installer may change in the future. For example, the installer package name should be "com.google.android.feedback" (see here ), and now it is "com.android.vending" .
2) Checking the packagename installer for piracy reasons is equivalent to using Base64 for password encryption - this is just bad practice.
3) Users who legally purchased the application can download the APK or download it from another backup application that does not install the correct packagename installer file and receives a license verification error. This is likely to lead to poor reviews.
4) As you already mentioned, pirates can simply install the packagename installer when installing the APK.
You must use Application Licensing or switch to In-app Billing .
source share