By the way, don't you guys think this should be written somewhere in
the Android docs ?

I think that currently, no app developer is aware of that problem.
Which means that whenever an Android user is connected to a company
network and needs to set an HTTP Proxy, the only working app will be
the browser.

Do you think I should fill a bug report for this ?

Ow, and one more thing : the -verbose-proxy option seems to be unknown
to the Android emulator... Has anyone been able to use it yet ?
Another bug report to fill ?

Cheers,
Piwaï

On Nov 12, 6:12 pm, Piwai <py.ri...@gmail.com> wrote:
> Hello Android People !
>
> I spent a few days on this kind of problems, so here is my feedback.
>
> duykham : your tip (setting proxy in APN) works... for the browser app
> only.
>
> Once you have done this configuration, you need to write specific code
> in your apps to handle a http proxy.
>
> If you use java.net.* components, then you shoud set the default
> ProxySelector in a static way :
>
>                 final String proxyHost = android.net.Proxy.getDefaultHost();
>                 final int proxyPort = android.net.Proxy.getDefaultPort();
>
>                 ProxySelector.setDefault(new ProxySelector() {
>
>                         @Override
>                         public void connectFailed(URI uri, SocketAddress sa, 
> IOException
> ioe) {
>                         }
>
>                         @Override
>                         public List<Proxy> select(URI uri) {
>                                 ArrayList<Proxy> l = new ArrayList<Proxy>();
>                                 SocketAddress sa = new 
> InetSocketAddress(proxyHost, proxyPort);
>                                 l.add(new Proxy(Proxy.Type.HTTP, sa));
>                                 return l;
>                         }
>                 });
>
> By the way, maybe you shouldn't use getDefaultHost/Post but rather
> getHost/Port(Context) .
>
> If you use a http client, then here is the solution :
>
>                 final String proxyHost = android.net.Proxy.getDefaultHost();
>                 final int proxyPort = android.net.Proxy.getDefaultPort();
>
>                 DefaultHttpClient client = new DefaultHttpClient();
>
>                 HttpHost proxy = new HttpHost(proxyHost, proxyPort);
>
>                 client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
> proxy);
>
> So, this is quite cool... and works on a per httpclient instance basis
>
> HOWEVER
>
> Google Maps still doesn't work. The reason is that the components that
> download all the stuff for Google Maps uses their own HttpClients. And
> we don't have any reference to this client, to be able to tweak them.
>
> IT SEEMS THAT GOOGLE MAPS COMPONENTS WERE NOT INTENDED TO WORK WITH
> HTTP PROXIES.
>
> I even tried to use the debugger and conditional breakpoints to inject
> a new HttpProxy in DefaultHttpRoutePlanner.determineRoute (line 104).
> But the debugger wouldn't allow any HttpHost instanciation, and says
> UnsupportedOperationException. I can edit strings, but not create new
> objects. Sad.
>
> If you have any clue, you are welcome to answer. And if someone find
> this mail in the archives some days and have a solution, please email
> me ;-) .
>
> I have read somewhere that a solution could be to disable anything
> related to proxies on Android, but rather use a Windows (or Linux)
> local software that would redirect all requests getting outside to the
> real proxy. I have no idea of how I could do this. Any idea ?
>
> Cheers,
> Piwaï
>
> On Nov 6, 9:16 am, Marc Reichelt <mcreich...@googlemail.com> wrote:
>
> > Hi duykham!
>
> > I just tried the solution you provide on your blog (Link again just
> > for the 
> > record):http://duykham.blogspot.com/2009/11/setting-proxy-for-android-by-gui....
> > But it seems this solution does not work for me, the emulator still is
> > not able to connect.
>
> > When will the -http-proxyoption be finally fixed? It really is a
> > severe problem for us here because we do not have Internet connection
> > without it. :-(
>
> > Regards
> > Marc
>
> > On 3 Nov., 09:58, duykham <duyk...@gmail.com> wrote:
>
> > > Hi Marc,
>
> > > Seems -http-proxyparameter does not work with emulator. In order to
> > > useproxyfor emulator, you can follow the guideline I posted on my
> > > blog.
>
> > > This 
> > > link:http://duykham.blogspot.com/2009/11/setting-proxy-for-android-by-gui....
>
> > > Hope this help.
>
> > > P/S: It works well with all versions from 1.6 to earlier. But, not
> > > work with Eclair (2.0), (I don't know the reason >"< )
>
> > > On Oct 23, 7:12 pm, Marc Reichelt <mcreich...@googlemail.com> wrote:
>
> > > > Hi again,
>
> > > > is there anyone out there who at least has the same problem?
>
> > > > Regards
>
> > > > Marc Reichelt   ||  http://www.marcreichelt.de/
>
> > > > On 22 Okt., 20:54, Marc Reichelt <mcreich...@googlemail.com> wrote:
>
> > > > > Hi there!
>
> > > > > I am developing applications for Android in a company where the
> > > > > Internet is accessable via aproxyserver only.
> > > > > I found out that the emulator of the 1.5 R3 SDK works well with the
> > > > > option -http-proxy, but the emulator of the 1.6 R1 SDK does not. Can
> > > > > anyone confirm this behaviour?
>
> > > > > Is this a bug in the 1.6 R1 SDK? And if so, is there a chance this
> > > > > gets fixed in - let's say - 1.6 R2?
>
> > > > > Or am I just doing something wrong, though providing the same options
> > > > > for the 2 different emulator versions?
>
> > > > > Many thanks in advance & regards
>
> > > > > Marc Reichelt   ||  http://www.marcreichelt.de/
>
>

-- 
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