How to use android:usesCleartextTraffic below Marshmallow android

五迷三道 提交于 2019-12-23 07:29:05

问题


I am trying to secure webview from cleartext traffic. As mentioned in the documentation. I have to set android:usesCleartextTraffic as false to achieve this. But this works on API level 23 and above. My minimum sdk is 22. How can I make sure app doesn't crash or create any problem on device running below API level 23 ? Or how can I programmatically set that attribute value in the application tag in Manifest.xml ?


回答1:


As suggested in Android Developers Blogspot, you don’t have to set minSdkVersion or targetSdkVersion of your app to 23 (Android Marshmallow) to use android:usesCleartextTraffic. On older platforms, this attribute is simply ignored and thus has no effect.Check this out

Hope this solves your query.



来源:https://stackoverflow.com/questions/48555256/how-to-use-androidusescleartexttraffic-below-marshmallow-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!