try {
PackageManager manager = context.getPackageManager();
PackageInfo appInfo = manager.getPackageInfo(
YOUR_PACKAGE_NAME, PackageManager.GET_SIGNATURES);
// Now test if the first signature equals your debug key.
boolean shouldUseTestServer =
appInfo.signatures[0].toCharsString().equals(YOUR_DEBUG_KEY);
} catch (NameNotFoundException e) {
// Expected exception that occurs if the package is not present.
}
备用留作
本文介绍了一种检查应用程序签名的方法,通过比较应用签名与预设的调试密钥来判断是否使用测试服务器。
980

被折叠的 条评论
为什么被折叠?



