Monday, June 4, 2012

Proxy Settings For Google Maps On the Android Emulator

Android Google Maps - Proxy settings for Emulator

Many of us have faced the problem when using the Google Maps app
on emulators when we are sitting behind a corporate firewall.

The Google Maps app just shows a blank screen.

Then we google (search) it up and we come up with many answers (most of them from stackoverflow.com)

Following are the steps on the internet in the order of least useful to most useful (in my opinion !!)

1. Many posts suggest that we go to the Emulator and do the following settings

    Get the Proxy Host Address and port number of your network
    Open the Menu->settings->Wireless & Networks->Mobile Networks->Access Point Names in Android Emulator
    Open Telkila
    Edit Proxy to your Proxy Host Address like-10.117.123.169
    Edit Port to the your Port like-8080
    Remove * from Username, Password and Server fields and make them blank().
    Set Authentication Type as “PAP or CHAP”
    Now, Press Menu->Save

    I got this one from Garg Engineer
   
    This works fine for the browser but not for apps using the Google Maps App.
   
2. Then there is a suggestion to start the emulator with the proxy settings from the command line as

   emulator.exe -avd Android2.3.3 -http-proxy http://:
   or
   emulator.exe -avd Android2.3.3 -http-proxy http://:@:
  
   For futher reference please see the Android Emulator reference @ http://developer.android.com/guide/developing/tools/emulator.html
  
   Where Android2.3.3 is the name of the virtual device I have created using my AVD manager targeted at Android 2.3.3, SDK Level 10.
  
   Now when your are sitting behind a corporate firewall you might have to type your username as: USERNAME or DOMAIN\USERNAME
  
   Also note if your password has the character '@' you will run into problems
  
   Now most of the corporates use Automatic proxy configuration URL, which looks like http://servername/xxxx.pac
  
   In such cases just type your proxy URL, i.e, http://servername/xxxx.pac in your browser.
  
   It will either prompt you to download a file or display the file in the browser itself.
  
   It might look like
  
  

  var proxyList = new Array();

  {
    proxyList[0] = "proxy1:port";
    proxyList[1] = "proxy2:port";
  }


   or
  
   var proxyConfig = "PROXY proxy:port";
  
   So extract your proxy IP and PORT and use them in the command line as specified above
  
   Unfortunately this might not work for all.
  
3. So finally the stuff that did work for me was to add the -dns-server option.

   To know what your DNS servers are, type ipconfig/all in your command line and you should see one or more DNS Servers

   So the proxy-setting that finally worked for me was like this
  
   emulator.exe -avd Android2.3.3 -http-proxy http://:@: -dns-server ,
  
   I got this from http://stackoverflow.com/questions/6339246/android-no-internet-access-on-emulator-proxy-settings
  
   Hope this helps