2

I know how to make http request on android. But how can i make an http request to a website and gurarantee the response is from the full site not the mobile version ?

Thanks

user1912383
  • 359
  • 2
  • 6
  • 16

4 Answers4

0

You should modify the user agent String ( to make it appear coming from a desktop browser ) Refer to link below :

Setting user agent of a java URLConnection

Community
  • 1
  • 1
Rudy
  • 7,008
  • 12
  • 50
  • 85
0

Try to remove the request headers or change all by which one can determine that it is a mobile device hope it help

belyjz
  • 187
  • 9
0

You need to set Your user agent like that.

 String ua = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101          
 Firefox/4.0";

    mWebview.getSettings().setUserAgentString(ua);
Rahul
  • 10,457
  • 4
  • 35
  • 55
0

This will help:

HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(url);
        String userAgent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";

        try {
            httppost.setHeader("User-Agent", userAgent);
            // Add your data

            // Execute HTTP Post Request
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity entity = response.getEntity();
Lazy Ninja
  • 22,342
  • 9
  • 83
  • 103