Im trying to get the 32px favicon.ico of the websites, but the response it obtain is the 16px favicon, I guess because I´m trying to obtain it by the smarthphone, but I try to change the user agent of the http petition with no result here is my code:
DefaultHttpClient client = new DefaultHttpClient();
String baseUrl = getBaseUrl(url);
HttpGet httpGet = new HttpGet(baseUrl + "/favicon.ico");
httpGet.setHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.45 Safari/535.19");
HttpResponse httpResponse = null;
try {
httpResponse = client.execute(httpGet);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}catch (NullPointerException e) {
e.printStackTrace();
}
InputStream is = null;
try {
is = (java.io.InputStream) httpResponse.getEntity().getContent();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
Drawable favicon = Drawable.createFromStream(is, "src");
final BitmapDrawable bd = (BitmapDrawable) favicon;
Any idea how to get it? Thanks