Search code examples
androidhttp-status-codeshttp-request

how to get/ask only status code for a httpRequest with android?


My question is pretty similar to that except but I need only the header of the response in order to reduce battery consomation.


Solution

  • You need to make a HEAD request. In the http protocol this will return to you only the Header of the response.

    http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4

    This can be done in android using HttpHead