How to Use Charles Proxy for Network Logging and Network Throttling on iOS and Android
Learn how to capture and analyze network logs on iOS and Android with Charles Proxy to debug APIs, troubleshoot connectivity issues, and optimize app performance.
.jpg)
How to Collect iOS and Android Network Logs with Charles iOS
Charles Proxy has both desktop and mobile (iOS) applications available. The desktop application requires more setup, but can return more detailed logs. Additional network debugging features such as throttling are only available on the desktop client. Depending on your testing needs, one or the other platform may be sufficient.
The Charles iOS app can collect simple network logs directly on an iOS device with relatively simple setup requirements. Follow the steps below to start logging network activity from the iOS mobile app you’d like to test.
How to Set Up Charles Proxy on iOS Devices
- Download and install the Charles Proxy app from the Apple App Store.
- On the main screen, toggle Status to Active.
- Tap Allow and authenticate with passcode or biometrics if prompted.
- Tap the gear icon to enter the Settings menu, then tap SSL Proxying.
- Tap Install SSL Certificate.
- Tap Allow.
- Tap Close.
- Install and Trust the Charles Proxy CA certificate in iOS system settings.
- Exact steps will vary by iOS version. For some versions, a device restart may be required.
- Reopen the Charles Proxy app. Make sure the Status toggle is still set to Active before continuing.
- Return to Settings > SSL Proxying. Confirm that the Enabled toggle is on.
- Confirm that the Certificate Status indicator says Trusted.
- Return to the Charles Proxy app’s main screen.
How to Collect In-App Logs on iOS for Your Test Scenario
- Start by tapping the broom icon to clear any extraneous logs.
- Execute the test flows for which you want to log network traffic
- Once the test flow is finished, tap the download or share icons in the Charles app to export the full list of logs.
- If you need more specific logs, you can also tap into each domain for which traffic was logged. Each domain’s logs can be downloaded or exported separately.
- Once finished exporting the logs, toggle Charles to Inactive on the main screen.
How to Collect iOS and Android Network Logs with Charles Desktop
The Charles desktop client requires two-part setup on both a computer and a test device, but offers deeper visibility into network requests and can accommodate a wider variety of testing scenarios. Follow the steps below to start capturing logs of your mobile app’s API interactions.
How to Set Up Charles Proxy on Windows or Mac
- Download, install, and open Charles Proxy on a compatible computer.
- In the menu bar, click Help > SSL Proxying > Install Charles Root Certificate. From there, you’ll be prompted to add the certificate to a keychain on your computer.
- Trust the certificate. On recent versions of Mac OS, you’ll need to open the certificate’s detail view in the Keychain app and switch the Trust setting option at the top of the list to Always Trust. Exact steps will vary by OS.
- In the Charles menu bar, go to Proxy > SSL Proxying Settings
- Add the wildcard * to the Include list. This tells Charles to intercept all of the SSL requests that it receives.
- Depending on your test case, you may want to include or exclude additional domains here. Including too many domains may lead to cluttered logs.
- You generally don’t need to specify any particular Port number, but this may vary based on the configuration of your network.
- Toggle off macOS Proxying from the Proxy > macOS Proxying toolbar menu. By default, Charles will also proxy the traffic coming into your computer, which is not always relevant to the app activities being tested on the mobile device.
- While most mobile network test scenarios are unlikely to use this option, if your test scenario does require network logging to or from the computer itself, leave this toggled on.
How to Set Up iOS and Android Test Devices to Work with Charles Desktop Proxy
- Make sure Charles is running on your computer.
- In the Charles menu bar, navigate to Help > SSL Proxying > Install Charles Root Certificate on Browser or Mobile Device.
- In your test device’s wi-fi settings, set a manual proxy to the IP address and port listed in the popup message that appears.
- Once you save the proxy settings and reconnect to the Internet on the test device, a popup message in Charles should appear, indicating that a connection request has been received from the device. Tap Allow on this popup.
- If this popup does not appear, additional network setup may be required. Start by making sure both your computer and device are connected to the same wi-fi network.
- If you accidentally tap Deny, you can retry by searching for “Access Control” in the Charles help menu, removing the device’s entry in the list, and reconnecting the device to your proxy.
- In a web browser, navigate to chls.pro/ssl to download and install the certificate.
- Install and trust the certificate in your mobile device’s system settings. Exact steps will vary by OS and version, but most recent iOS versions may require a device restart here.
How to Collect Network Logs on Charles Desktop for your iOS or Android Test Scenario
- Start by tapping the Broom icon to clear any extraneous logs already recorded.
- Start logging and start SSL proxying by tapping the Record and Lock icons at the top of the Charles window.
- These settings can also be accessed via the Proxy menu bar menu.
- Execute the desired test steps on your mobile device.
- Use the action icons or toolbar menu to stop proxying and recording.
- View and investigate the logs that appear along the left side of the main Charles view.
How to Use Charles Desktop to Test Network Throttling on iOS and Android
The network throttling feature in Charles simulates a variety of slow or spotty Internet connections, using either preset suggestions or granular manual controls over each network quality benchmark. For Android device tests, or for other testing scenarios not easily covered by network throttling tools like Apple’s Network Link Conditioner, Charles Desktop can be an effective option. Follow the steps below to start simulating network conditions on a mobile test device.
- Install and open Charles desktop on your computer.
- Connect your test device to a manual proxy using the IP address and port specified by your computer’s Charles instance
- Refer to the network logging setup steps for more detailed setup instructions, but please note that the steps related to installing and trusting SSL certificates are not required if you are only using the throttling feature.
- Navigate to Proxy>Throttle Settings… and toggle on the Enable Throttling checkbox.Â
- Choose what network conditions you’d like to simulate in the popup window.
- If you aren’t sure what exact settings to choose, the presets can be a good place to start. The 3G and 4G cellular network presets are particularly relevant to mobile device test scenarios.
- Once your settings are set, you can also use the Turtle icon or the Proxy > Start/Stop Throttling menu item to turn throttling on/off.