gpt4 book ai didi

android - 如何在android中使用自签名证书注册的https链接?

转载 作者:太空宇宙 更新时间:2023-11-03 14:45:01 25 4
gpt4 key购买 nike

我想在安卓浏览器中打开一个链接。我使用了下面的代码。它按预期工作正常。

Intent updateIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.example.com");
context.startActivity(updateIntent);

但是当我在 android chrome 浏览器中打开 https url 时,它说浏览器中出现私有(private)连接错误。问题是 Web 服务器使用自签名证书注册。我认为问题出在证书上,因为 android chrome 浏览器中不包含证书,因为证书是自签名的。如何在自签名的 Android 浏览器中打开链接。

最佳答案

所以做一件事像这样将值 https 替换为 http

String value = "http://www.example.com";        
Intent updateIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(value.replace("https", "http"));
context.startActivity(updateIntent);

然后就可以了...希望对你有帮助

关于android - 如何在android中使用自签名证书注册的https链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39717506/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com