Created
February 10, 2017 14:43
-
-
Save ZahidRasheed/39e6163d14ff7b95e0fd7f5c5ef0b47c to your computer and use it in GitHub Desktop.
Find if the app is installed from a trusted source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isTrustedInstallation(Application app) { | |
PackageManager packageManager = app.getPackageManager(); | |
String installerId = packageManager.getInstallerPackageName(app.getPackageName()); | |
if (installerId == null) { | |
return false; | |
} else if (installerId.contains("aptoide")) { | |
return false; | |
} else if (installerId.contains("xiaomi")) { | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment