Skip to content Skip to sidebar Skip to footer

Android Urlconnection Does Only Work In Wifi, Not With 3g

I have written an app which uses an URLConnection to get a .html file. Everything works fine over wifi. But over 3g the file is not returned correctly. When i try to access the w

Solution 1:

Maybe it's a little bit late for answer but I had the same problem, with Wifi the html downloaded had different spaces than the one downloaded with 3G.

I solved it deleting the User-Agent in the connection:

URLConnectionconn= url.openConnection();  
conn.setRequestProperty("User-Agent","");

I hope it helps someone!

Post a Comment for "Android Urlconnection Does Only Work In Wifi, Not With 3g"