我尝试静默安装 .p12 证书,我安装了一个签名的 apk 以获得系统应用程序权限,但它不起作用。
final FileInputStream fileInputStream = new FileInputStream("cert.p12");
byte keychain[] = new byte[(int) fileInputStream.available()];
fileInputStream.read(keychain);
DevicePolicyManager dpm = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
if(! dpm.installCaCert(getComponentName(),keychain))
{
Toast.makeText(this,"installCaCert Failed",Toast.LENGTH_LONG).show();
}
吐司显示“installCaCert 失败”