Android HTTPS socket closed的解决方法

最近碰到一个问题,我在集成百度地图和百度导航后https网络访问失败,必须杀进程才能继续访问网络

查了两天终于解决了了这个问题

1.我用的是

httpClient请求,用https请求时会用到这样
设置
HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
            HttpProtocolParams.setContentCharset(httpParams, HTTP.UTF_8);
            SchemeRegistry schemeRegistry = new SchemeRegistry();
            schemeRegistry.register(new Scheme("http", PlainSocketFactory
                    .getSocketFactory(), 80));
            schemeRegistry.register(new Scheme("https", 
SSLSocketFactory
        .getSocketFactory()
, 443)); ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager( httpParams, schemeRegistry);这样到
SSLSocketFactory时访问常就停着了,最后网上查了下还汇报异常
No peer certificate
参考这个
[Android实例] http请求No peer certificate的解决方法点击打开链接
就是在socket closed时在创建新的socket就行

你可能感兴趣的:(Android技术)