user10089226
user10089226

Reputation: 81

Android Studio warning " Setting <base-config cleartextTrafficPermitted="true"/> is not recommended."

I'm integrating PayUMoney with my app. For Android versions above 9 cleartextTrafficPermitted="false" by default. So I get the following error:

The webpage at http://180.179.174.15:3000/pgSimulator/axis/redirect could not be loaded because: net::ERR_CLEARTEXT_NOT_PERMITTED

So in network_security_config.xml, I changed it to true as below:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true"/>
</network-security-config>

And now Android Studio shows:

Setting is not recommended.

Now is it safe to set it to false? If I don't set it to false. PayUMoney does not work. So what to do now?

Upvotes: 1

Views: 2093

Answers (1)

Md. Asaduzzaman
Md. Asaduzzaman

Reputation: 15433

Either use

<application
    ...
    android:usesCleartextTraffic="true">
    ....
</application>

Or set config like below with domain:

<network-security-config>
  <domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">Your_domain</domain>
  </domain-config>
</network-security-config>

Upvotes: 1

Related Questions