Network Security Configuration File

Hey everyone!

I’m integrating third-party sdk, which requires some settings in network_security_config.xml. ( Caching on Android 9 - Audience Network - Documentation - Facebook for Developers )
I already used plugin language to modify andoird_manifest.xml file, but is there any way to modify network_security_config.xml file or I can just create new one and mofify it from text editor?

Anyone? I would really appreciate any help here :frowning:
At least maybe someone can tell me how I can modify android manifest.xml file with the help of UPL to add custom network secutre condig, like google documentation says?

  <?xml version="1.0" encoding="utf-8"?>
<manifest ... >    
<application android:networkSecurityConfig="@xml/network_security_config" ... >

I know this is old an old post, but I thought I’d add an answer as I’ve recently had to do this myself.

Add something like this (tailored to your project obvisouly) to your UPL file to add the entry to the android manifest: (got the information from here: Android: how to add an xml file to res/xml - UE4 AnswerHub )

<copyFile src="$S(ProjectDir)/Plugins/(YourPlugin)/Source/(YourPlugin)/network_security_config.xml"
dst="$S(BuildDir)/res/xml/network_security_config.xml" />

And in the AndroidManifestUpdates section, add this:

<!-- Facebook network security configuration -->
<addAttribute tag="application" name="android:networkSecurityConfig" value="@xml/network_security_config"/>

Then place your network_security_config.xml file in (YourProject)/Plugins/(YourPlugin)/Source/(YourPlugin)/ and it will copy it from there during the build.