Home:ALL Converter>How to use android:usesCleartextTraffic below Marshmallow (API-23)

How to use android:usesCleartextTraffic below Marshmallow (API-23)

Ask Time:2018-02-01T12:16:53         Author:sagar suri

Json Formatter

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 ?

Author:sagar suri,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48555256/how-to-use-androidusescleartexttraffic-below-marshmallow-api-23
Mayank Bhatnagar :

As suggested in an article @ Android Developers Blogspot:\n\nYou 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.\n\nHope this solves your query.",
2018-06-20T07:08:32
yy