I've had problems setting a proxy from 1.5, using Eclipse 2.5 Galileo
on Windows XP.

I've tried:
1. Setting the default proxy from Windows > Preferences > Android >
Launch.
2. Adding to '-http-proxy http://www.example.com:80' Debug
Configurations > Target (pane) > Additional Emulator Command Line
Options (you need to resize the dialog to see this).
3. Setting the proxy on the emulator from Settings > Wireless controls
> Mobile Networks > Access Point Names > T-Mobile US > ...

For me, none of these works on its own.

A colleague tells me that 2. works on his Mac.

What I do now is set the proxy on the emulator (as per 3.) and use the
following in my code:

final String proxyHost = android.net.Proxy.getDefaultHost();
final int proxyPort = android.net.Proxy.getDefaultPort();

if (proxyPort != -1)
{
        System.setProperty("http.proxyHost", proxyHost);
        System.setProperty("http.proxyPort", Integer.toString(proxyPort));
}

I'm fairly new to Android, so not sure if this the right or best way
to do it.

getDefaultPort() returns -1 if no proxy port has been set.

Sam Dutton

......................................................

On Jan 12, 3:59 pm, Milky <bboymi...@gmail.com> wrote:
> Dear all Android Emulator
>
>   I'm developing android application in my university that must use
> the internet through proxy server. In Android SDK 1.5 I use parameter -
> http-proxy when starting emulator and it working. But since Android
> SDK 1.6 until now (2.1) this approach is not working. I don't know hot
> to fix this problem.
>
>   Do you have any solutions?
>
>  best regard.
>
> Ù:-)
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to