Java Code Examples for android.content.pm.PackageManager.checkSignatures()

The following are Jave code examples for showing how to use checkSignatures() of the android.content.pm.PackageManager class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Brevent   File: BreventActivity.java   View Source Code Vote up 5 votes
private boolean isFrameworkPackage(PackageManager packageManager, String packageName) {
    if (fakeFramework) {
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
            return isFrameworkPackage(packageManager, packageInfo);
        } catch (PackageManager.NameNotFoundException e) {
            UILog.w("cannot find " + packageName, e);
            return false;
        }
    } else {
        return packageManager.checkSignatures(PACKAGE_FRAMEWORK, packageName) ==
                PackageManager.SIGNATURE_MATCH;
    }
}
 
Example 2
Project: Matrix-Calculator-for-Android   File: GlobalValues.java   View Source Code Vote up 5 votes
public void SetDonationKeyStatus() {

        if (BuildConfig.DEBUG) {
            Status = true;
            return;
            //if debug mode, avoid the advertisements and use pro features
        }
        try {
            PackageManager packageManager = getPackageManager();
            packageManager.getPackageInfo("com.softminds.matrixcalculator.pro.key", 0);
            //Key is Installed
            //Checking the Authenticity of the Key
            if (packageManager.checkSignatures(getPackageName(),
                    "com.softminds.matrixcalculator.pro.key")
                    == PackageManager.SIGNATURE_MATCH) {
                Log.d(TAG, "The Signature of Key Matched with Application");
                String manager = packageManager.getInstallerPackageName("com.softminds.matrixcalculator.pro.key");
                if (manager != null) {
                    //Status = true;
                    Log.d(TAG, manager);
                    if (Objects.equals(manager, "com.android.vending")) {
                        Status = true;
                    } else {
                        Status = false;
                        Toast.makeText(this, R.string.clear_warn_invalid_install, Toast.LENGTH_LONG).show();
                    }
                }
                //the Key is Genuine and was Installed from Play
            }
        } catch (Exception e) {
            Status = false;
        }
    }
 
Example 3
Project: Brevent   File: BreventActivity.java   View Source Code Vote up 4 votes
private boolean isBreventFramework() {
    PackageManager packageManager = getPackageManager();
    return packageManager.checkSignatures(PACKAGE_FRAMEWORK, BuildConfig.APPLICATION_ID) ==
            PackageManager.SIGNATURE_MATCH;
}
 
Example 4
Project: Zero   File: Utils.java   View Source Code Vote up 4 votes
public static boolean checkProVersion(Context context) {
    PackageManager manager = context.getPackageManager();
    return (manager.checkSignatures(context.getPackageName(), PRO_NAME) == PackageManager.SIGNATURE_MATCH || (BuildConfig.DEBUG && Constants.DEBUG_PRO));
}
 
Example 5
Project: prevent   File: PackageUtils.java   View Source Code Vote up 4 votes
public static boolean isSystemSignaturePackage(PackageManager pm, String packageName) {
    return pm.checkSignatures("android", packageName) != PackageManager.SIGNATURE_NO_MATCH;
}