Categorized | Android Dev, Tips

Tips: Howto Connect Android Emulator behind proxy

Posted on 18 November 2007 by Hatem Ben Yacoub

If you are behind a proxy and looking to connect the emulator to Internet, Luisa Magarian have posted the way to set proxy for the emulator. It uses the command line and the adb utility. First change directory to the emulator tools folder, you will find also the adb utility there. Run the emulator, then from command line :

  1. ./adb shell sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db “\”INSERT INTO system VALUES(99,’http_proxy’,’ [host_or_IP]:[port]‘);\””
  2. Change [host_or_ip] and [port] to your correct proxy values
  3. Try to connect from Android and it should be working fine.

Luisa posted also the way to access some Android’s system setting using SQLite, this will help to get more information on how Android work, for example to retrieve all settings :

  1. ./adb shell sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db “\”SELECT * FROM system\””
  2. This will return :
    1|music_volume|3
    2|voice_volume|3
    3|ringer_volume|3

OHM

« | Home | »

20 Comments For This Post

  1. Ufux Says:

    So the hack works for the browser … fair enough.
    Unfortunately it does not for the map viewer.

    Ufux

  2. molo Says:

    Tnx,
    It works.

  3. molo Says:

    2 Ufux

    The same :(

  4. gaojinxuan Says:

    How can i connect to the Map in Android through a proxy server which need username and password?

    Thanks :)

  5. senthil Says:

    Hi,
    i set the proxy…browser works fine. but i can’t view the map.anyone can tell me…what is the solution..

  6. rmeph Says:

    i have same problem Blank screen without any map show on my Android emulator……plz help how to acess map on android emulator??

  7. Swap Says:

    What should i give in ‘http_proxy’ field?

    I am not getting it.

    My IP is DHCP enabled. So is there any problem caused by this?

    Plz reply..

  8. Mitchell Says:

    How if the proxy setting is automatically by a http://xx.xx.xx/xx.pac

  9. Ewan Says:

    How can i connect to the Map in Android through a proxy server which need username and password?

  10. Jagtap jalandar Says:

    I am using following and gives folooeing result
    If anybody have answer plz reply me

    E:\jagtap\Andriod SDK\android-sdk-windows-0.9_beta\tools>adb shell
    # sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db

    sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db
    sqlite3: not found
    #

  11. Jagtap jalandar Says:

    I am using following and gives following result
    If anybody have answer plz reply me

    E:\jagtap\Andriod SDK\android-sdk-windows-0.9_beta\tools>adb shell
    # sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db

    sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db
    sqlite3: not found
    #

  12. Avinash Says:

    Hi, I am getting proxy issue.
    In office not able to run map application. Tried to execute INSERT on system table fails. Can anybody give exact steps to be followed.
    Thanks!!
    Avinash.

  13. Alex Shoykhet Says:

    Hi, the reason that Browser works and Maps doesn’t is that Browser calls an API in WebView called ‘enablePlatformNotifications’ – this API will cause a listener to be setup which will eventually set the proxy for the current request queue.

    If you were to write your own Activity and use WebView, all you would need to do would be to call WebView.enablePlatformNotifications() … you could rebuild Maps from source and add that line in the Activity onCreate method…

  14. Ravi Says:

    I am using WebView.enablePlatformNotifications() this line in my OnCreate()
    of my application but still not working. Is anybody tried this API and working? If so please suggest me how to use.

  15. bobo Says:

    i have same problem Blank screen without any map show on my Android emulator……plz help how to acess map on android emulator through proxy??

  16. Gerald Logor Says:

    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’,’:’);

    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 : in Additional emulator command line options.

  17. Ron Smith Says:

    This fix doesn’t seem to be working anymore. Maybe something changes with the 1.5 release?

  18. Henry Duke Says:

    There is a much easier way of doing this.

    With in the emulator GUI you can go Menu > Settings > Wireless
    Controls > Mobile Networks > Access Point Names and create a new Access Point which connects to your proxy server. Taken me several hours to locate this but it seems to have worked a dream :o)

  19. Denis Bareis Says:

    Hi,

    Silly question but why doesn’t google “fix” Android to support proxies via the GUI (connection properies)? I’m amazed that this is missing.

  20. Melanie Hertling Says:

    Thanks for this post, answers a bunch of questions I was having.

1 Trackbacks For This Post

  1. My daily readings 07/17/2009 « Strange Kite Says:

    [...] Tips: Howto Connect Android Emulator behind proxy | Open Handset Magazine [...]

Leave a Reply

Advertise Here
Advertise Here