I used to use Charles back in the days of Flash dev and found myself missing it trying to diagnose an edge case network issue recently (on a Samsung Galaxy 7) – it allows you to throttle specific requests, as well as map calls to dummy responses, both of which came in handy for the above.
After a bit of tinkering I got it working, here are the steps:
In your Unity project, add the following to the
application element in your android manifest:
network_security_config.xml in the following folder:
Contents of network_security_config.xml:
<network-security-config> <base-config> <trust-anchors> <certificates src="user" /> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
Mozilla proxy in proxy settings to only see traffic from phone
A quick way to find your ip is to go to Charles and select
Help &gt; SSL Proxying &gt; Install Charles Root Certificate on a Mobile Device or Remote Browser. This will give you the proxy ip and port, and the url to grab the security certificate from to install on your phone.
On your phone:
– Go to
Settings &gt; Connections &gt; Wi-Fi
– Tap and hold on your Wifi network
Manage Network Settings
Show advanced options
Manual from the Proxy dropdown
Proxy host name, enter the proxy ip address
Proxy port, enter the port (usually 8888).
– On your desktop, you should get a pop up from Charles telling you about a connection attempt. Click on
– Back on your phone, Open a browser and go to
– You should get a download notification for the certificate. Once downloaded, you should see a pop up asking you to name the certificate (doesn’t matter what you put here). Make sure that VPN and apps is selected in the dropdown and click on
– Go to
Settings &gt; Lock Screen and Security &gt; Other Security Settings &gt; View Security Certificates
– You should see the certificate you downloaded installed under the
User tab (the User and System tabs are the two different certificate types, which relate to the security xml file we created above).
Once this is done, you should see network traffic showing up in Charles.
NB. If you don’t see any traffic, you might need to specify a proxy for whatever you’re using to make requests (I had to do so when using WebClient in Unity).
NB. You don’t want the above to be included in anything but a test build – I’ve added a preprocessor script to my unity build that will add these settings only on local builds when requested, but also runs checks to make sure these settings don’t exist in cloud/release builds.