Android API 28 配置 networkSecurityConfig

在一個項目中既用到了 科大訊飛聽寫API,又要訪問自己的服務器(非HTTPS)。

而當升級到Android API 28時,需要配置networkSecurityConfig 才能訪問服務器,

https://blog.csdn.net/xyx2999/article/details/82909582

但是按上述鏈接中配置,服務器可以訪問了,但是訊飛API不能用了。

於是查找資料,參考

https://www.jianshu.com/p/19b8294f4ac2

https://blog.csdn.net/qq_30135181/article/details/80108525

將network_security_config如下配置:

<domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">XXX.XXX.XXX.XXX</domain>
</domain-config>

只將本服務XXX.XXX.XXX.XXX器放開。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章