Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid application - Google Authorization via HTTP Post
    primarykey
    data
    text
    <p>I am just trying to send my Google account authentication data via HTTP POST. I have built the HTTPpost (URLencoded the ArrayList name - value pair) and executed the HTTPClient to get the HTTPResponse. However this is where the problem starts, the HTTPResponse I get back seems to return an exception anytime I try to call one of its associated methods (getStatusLine or getEntity). I also tried to check for "null" response, by doing a simple "if (null) else" type checking, but still no luck. </p> <p>Is this problem because I am using the emulator? </p> <p><strong>-----UPDATE-----</strong></p> <p>I have found out that I am getting a NULL Pointer response, which causes the exception. So, there is an issue with the way I am accessing the Google API. The URL is "https://www.google.com/accounts/ClientLogin" and "Email" and "Passwd" are the two parameters I use for the POST request. </p> <pre><code>HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("&lt;URL HERE&gt;"); try { List&lt;NameValuePair&gt; parameters = new ArrayList&lt;NameValuePair&gt;(2); parameters.add(&lt;name_value_pair&gt;); parameters.add(&lt;name_value_pair&gt;); httppost.setEntity(new UrlEncodedFormEntity(parameters)); HttpResponse response = httpclient.execute(httppost); StatusLine returned_status = response.getStatusLine(); int status_code = returned_status.getStatusCode(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } </code></pre> <p>} </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload