I have an issue in my application Cleartext HTTP traffic to x not permitted.
I've already tried putting android:usesCleartextTraffic="true" in my manifest. But i want to change "android:usesCleartextTraffic" flag to "false" to prevent unencrypted traffic from being sent.
How to solve this?
Assuming you are accessing a server that doesn't support HTTPS, then you can create exceptions in your network security config. You can create a file
net_sec_conf.xmllike this:and then in manifest file add this line:
(assuming you have put the file in xml folder). This way cleartext HTTP traffic will only be allowed for the specified domain.
Of course, if the server supports HTTPS, then you just need to change your URL "http://..." to "https://...".