Return to site

Charles Proxy Android

broken image


Charles Proxy is a HTTP/HTTPS traffic viewer by which you can view the traffic between your device and the internet. Since the MoPub SDK uses HTTP/HTTPS to request and receive ads, Charles can be used to see what is happening for debugging and testing apps ad request/response.

Install and Register Charles Proxy

  1. Download Charles Proxy here.
  2. On the Charles menu bar, go to Help > Register Charles…. You can also use a trial version with some limitations.

Setup Proxy

  1. Aiseesoft pdf converter pro 3 2 55 download free. Open Charles

    The first time you launch Charles, you will be asked to grant privileges to change your Network Settings. Click 'Grant Privileges' and enter your password when prompted.

  2. Enable Proxy ( Proxy > Proxy Settings… > Proxies )

  3. Enable SSL Proxying ( SSL Proxy Settings… )

    Add a wildcard host to enable all SSL:

    Or explicitly add MoPub host to the list:

  4. Add MoPub host to Focussed Hosts ( View > Focussed Hosts… > Add )

I use Charles Proxy extensively for debugging all kinds of applications, and lately I've been using it more with mobile devices. One of the killer features of Charles is its ability to intercept SSL traffic. This is hard - and rightly so, it should be difficult to inspect SSL traffic! On a network that uses WPAD, you'll have to either point Android at the appropriate automatic proxy configuration script or manually enter proxy server settings. Let's just proxy curl's request to it as well and compare the breakdown of the curl and Android requests. Tap 'Modify Network' when a menu appears. Expand the 'Advanced options' section on this. Validate that the Mac/PC running Charles Proxy are on the same network (Presumably wifi). You may be able to ping the mobile device from the Mac/PC Charles Host. On the Android device make sure that in the wifi settings you have Advanced Config Checked, and have pointed the device to the IP address of the Charles Proxy Host. HOW TO SET UP ANDROID EMULATOR. Once we set up Charles Proxy, we are going to set up our Android emulator. For that, when the time of launching it arrives, we will need to pass the IP of our Charles Proxy as an environment variable (in Charles Proxy: Help Local IP Address), with something similar to the following command.

Connect Your Devices

Android

  1. Go to Settings > WiFi and connect to the network your computer is connected to

  2. Long press the network until the modal appears, then click Modify Network. Select Advanced Options to reveal proxying options. Configure the following:

iOS

Charles
  1. Go to Settings > WiFi and connect to the network your computer is connected to
  2. Select 'i' next to the network, and scroll down to HTTP Proxy and select Manual. Configure the following:

You should see a prompt when your device successfully connect to your computer, press Allow to complete the connection.

Install SSL Certification on Your Devices

  1. Go to Help > SSL Proxying > Install Charles Root Certificate on a Mobile Device…

  2. On your Android or iOS device, follow the instruction to browse to http://chls.pro/ssl to download and install the certificate.

  3. Navigate to Settings > General > Profile & Device Management to install and verify the Charles SSL certificate.

  4. Navigate to Settings > General > About > Certificate Trust Settings to mark the Charles Root certificate as trusted.

Important

On Android 7+ :

Charles Proxy Android Emulator

If Charles is not able to decrypt https traffic, please follow this insturction to add a network_security_config.xml and modify your AndroidManifest.xml in your app.

res/xml/network_security_config.xml AndroidManifest.xml

Note: please remember to revert this before your app goes live.

On iOS 10.3+ :

You have to go to Settings > General > About > Certificate Trust Settings to toggle the full trust of the certificate.

Test and View MoPub Ad Requests/Responses

  1. Launch MoPub Sample App or your own apps that has integrated MoPub SDK. Deck set 2 0 1 – simple presentation creator download.

  2. Go to Charles Files > New Session to start a new recording if need be.

  3. Click on the besom icon to clear the logs, and make sure to enable the recording.

  4. Trigger ad requests and reproduce any issues you've encountered.

  5. You should start seeing the ad requests and responses decrypted as below:

  6. Click Focused or type ‘mopub' into the Filter to filter out the traffic that are sent through the MoPub server.

    Below will be exposed in the Charles log if ad requests to MoPub were captured:

    • MoPub ad request:
      • http://ads.mopub.com/m/ad
    • MoPub attempt tracker:
      • http://ads.mopub.com/m/attempt
    • MoPub impression tracker:
      • http://ads.mopub.com/m/imp
      • http://mpx.mopub.com/imp (for Marketplace only)
    • MoPub click tracker:
      • http://ads.mopub.com/m/aclk
      • http://mpx.mopub.com/aclk (for Marketplace only)
    • MoPub conversion tracker:
      • http://ads.mopub.com/m/open
  7. Disable the recording.

Save and Send Session Logs

  1. Ensure your session logs are decrypted.
  2. Recorded sessions can be saved as .chls files, or exported as HTTP Archive (HAR) logs from File > Export Session…
  3. Send the files to your account manager.

FAQ

Why can't I see any traffic recorded in Charles?

  • Ensure your Charles Recording toggle is on.
  • Confirm if your mobile and your computer are connecting to the same WiFi.
  • Confirm if the proxy IP is identical with your computer's IP.
  • Restart your Charles tool on your computer, and reconnect your devices to the WiFi.
  • Disable any VPN on your mobile.

Why is my https logs are encrypted?

  • Ensure your SSL Proxying is enabled and already allowlisting correct host name.
  • Redo the steps in the secton: 'Install SSL Certification on Your Devices'.
  • Restart your Charles tool on your computer, and reconnect your devices to the WiFi.

Last updated October 02, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)

If you want to see the data being transmitted when you visit a website/host on your mobile device or if you want to modify the api calls even, you might want to use Charles Proxy for this purpose. So what's the first step to make your mobile device communicate with Charles Proxy app installed on your laptop?

Charles Proxy Android Tutorial

  1. Install Charles root certificate on your laptop
  2. Install Charles root certificate on your ios or android device by typing ‘chls.pro/ssl' in your mobile device's browser
  3. Go to Settings -> Wifi -> Modify network (tap the (i) icon on ios or long tap on android)
  4. Android: Select Advanced options -> Manual Proxy
    iOS: Scroll down to ‘HTTP Proxy' section and select ‘Manual'
  5. Now we can configure Charles as a proxy server for all applications used on your mobile device:
    Server (Proxy Host Name): This is the IP address of your computer running Charles, usually 192.168.X.X. Charles will tell you your IP address if you go to Help -> SSL Proxying -> Instal Charles Root Certificate on a Mobile Device or Remote Browser (see screenshot at point 2 above)
    Proxy port: usually 8888
    Authentication: OFF (iOS)
  6. All of your web traffic from your iPhone will now be sent via Charles. You should see a prompt in Charles when you first make a connection from your mobile device, asking you to allow the traffic. Allow this connection.
  7. Now go to Charles on your computer and run the application you want to test/track your device. Notice a new node appeared in the tree on the left for each website you visit or application you run. Right click on the node and select ‘Enable SSL Proxying'. From now on you'll be able to see the events and data being transmitted.
  8. IMPORTANT! Don't forget to turn OFF the manual Proxy settings on your mobile device when you're done with Charles Proxy. Whenever you have Charles configured as a proxy server on your iphone or android device and Charles is not running on your computer (or you entered incorrect IP address) you start getting network failures on your device and websites/applications won't load.




broken image