Pages

Wednesday, 2 April 2014

Intercept HTTP Requests sent from app on Android emulator

Usecase:
In this usecase, I will show you how you can track HTTP requests fired from a custom application deployed on the Android emulator. We will be tracking the requests using HTTP Analyzer, which is an in-built tool provided by JDeveloper. This is especially handy if you are using ADF Mobile and want to monitor your HTTP/web service requests.

Steps:
At JDeveloper end:
In JDeveloper, go to Tools-> HTTP Analyzer. The analyzer window opens up next to server console. Click on Analyzer Preferences.



Note down the host and port values.Also, start the HTTP Analyzer.



At Android emulator end:
Close the emulator if it is open. Go to the folder in which 'emulator' resides (In my case, it was something like C:\Android\adt-bundle-windows-x86_64-20130219\sdk\tools) and invoke a command prompt. Type in the command:

emulator -avd emuName -http-proxy http://<SYSTEM_IP>:<PORT>

where emuName should be replaced with your emulator instance's name; SYSTEM_IP should be replaced with your system's IP address and PORT should be the port where HTTP Analyzer is running(noted down previously).
This will start the android emulator for you and redirect all the requests through the HTTP Analyzer.
That's it! Run your app on the emulator and you should be able to see the requests being logged in HTTP Analyzer.

Sample interception:



No comments:

Post a Comment