在一個項目中既用到了 科大訊飛聽寫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器放開。