本文整理汇总了Java中android.content.pm.PackageManager.checkSignatures方法的典型用法代码示例。如果您正苦于以下问题:Java PackageManager.checkSignatures方法的具体用法?Java PackageManager.checkSignatures怎么用?Java PackageManager.checkSignatures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.pm.PackageManager
的用法示例。
在下文中一共展示了PackageManager.checkSignatures方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkProVersion
import android.content.pm.PackageManager; //导入方法依赖的package包/类
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));
}
示例2: isFrameworkPackage
import android.content.pm.PackageManager; //导入方法依赖的package包/类
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;
}
}
示例3: SetDonationKeyStatus
import android.content.pm.PackageManager; //导入方法依赖的package包/类
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;
}
}
示例4: isBreventFramework
import android.content.pm.PackageManager; //导入方法依赖的package包/类
private boolean isBreventFramework() {
PackageManager packageManager = getPackageManager();
return packageManager.checkSignatures(PACKAGE_FRAMEWORK, BuildConfig.APPLICATION_ID) ==
PackageManager.SIGNATURE_MATCH;
}
示例5: isSystemSignaturePackage
import android.content.pm.PackageManager; //导入方法依赖的package包/类
public static boolean isSystemSignaturePackage(PackageManager pm, String packageName) {
return pm.checkSignatures("android", packageName) != PackageManager.SIGNATURE_NO_MATCH;
}