This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Android and the fly likes Proxy settings for Emulator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "Proxy settings for Emulator" Watch "Proxy settings for Emulator" New topic
Author

Proxy settings for Emulator

chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

http://<machineName>:<port>;

Or

http://<username>:<password>@<machineName>:<port>;

How to use this ?


http://www.androcid.com/
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
http://d.android.com/guide/developing/tools/emulator.html#proxy


Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

[I am not sure if I recall this correctly...try this if you want to]

There is a com.android.providers.settings folder on the emulator(inside data/data/) which has a database named settings.db.In this database, there is a table called "system". You can insert a row in this table which contains details of your proxy.

I think I was able to connect to internet from the browser of my emulator after this..





[List of FAQs] | [Android FAQ] | [Samuh Varta]
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
You used to have to make the database change but in current versions the option seems to be sufficient.
shruthi sridhar
Greenhorn

Joined: Oct 10, 2007
Posts: 11
You can follow these steps to set up proxy for emulator:

1. Connect to the emulator using the "adb shell" command (From "tools" folder of SDK)
adb shell
enter this..
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> INSERT INTO system VALUES(99,'http_proxy','<PROXY_IP>:<PROXY_Port>');


2. Use the below command to check if the value is inserted
sqlite> SELECT * FROM system;

3. Restart the emulator and check for the browser to work.

4. An alternate if this doesnt work is, Go to Run -> Run Configurations ->Target in eclipse and enter
-http-proxy <PROXY_IP>:<PROXY_Port> in Additional emulator command line options.

Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Ed Burnette wrote:You used to have to make the database change but in current versions the option seems to be sufficient.

I concur with you, Sir. Lately, I have been using the command line switch(-http -proxy) to start the emulator instances(but I think the row in the system table is still there unless I have chosen to "wipe data").

I wonder what all can be set for emulator by making an entry in system table. What is the domain set of settings!?
Is using the system table deprecated?

Thanks.
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
Using the system table is definitely not the recommended way to do things, and it's undocumented and subject to change with each release. That said, there are probably some interesting things in there if you find yourself bored one afternoon. Personally I'd rather take the time to read the source. Or to keep up with Android forums.
 
GeeCON Prague 2014
 
subject: Proxy settings for Emulator