Reputation:
My question: How to allow internet access via http in android studio? I've googled this for a while but i can't find a working answer. I've tried to add that to my manifest, but D/NetworkSecurityConfig: No Network Security Config specified, using platform default
still is showing up when i run the game:
Tried that:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
android:usesCleartextTraffic="true">
Does anybody know what I might be missing? I'm thankful for any help! :)
PS: I created the game in Unity and exported it to android studio.
Upvotes: 1
Views: 1234
Reputation: 122
Create xml under res directory and then network_security_config.xml in XML folder and put in xml file this code:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
and add this line to your application tag in manifest
android:networkSecurityConfig="@xml/network_security_config"
i hope solve your problem...
Upvotes: 1