0
下面的代碼在4.0及以後的版本中成功安裝了CA,但它的工作效率低於4.0。任何機構都不知道我做錯了什麼。Android 4.0以下版本的CA證書安裝不起作用
private void showCAInstallationDialog() {
try {
InputStream caInputStream = getResources()
.openRawResource(R.raw.ca);
if (caInputStream != null) {
byte[] result;
result = IOUtils.toByteArray(caInputStream);
// The next line actually installs the certificate
Intent intent = new Intent("android.credentials.INSTALL");
intent.putExtra("name", getString(R.string.app_name) + " CA ");
intent.putExtra("CERT", result);
startActivityForResult(intent, CA_CERTIFICATE_ADDED);
} else {
Utility.logError(getSimpleName(),
"Error occurred while reading CA");
}
} catch (IOException e) {
e.printStackTrace();
}
}
定義「不起作用」 – njzk2