I have successfully configured the Android application that is logged in on my drupal website.
My problem is that the login session does not last very long. The site clearly displays my user as registered on the site, but within an hour or so the user is no longer displayed as active on the site. (I guess because I really don’t know for sure).
Can anyone understand why this is happening?
The code is as follows:
protected HttpResponse doInBackground(Void... params) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://mystestsite.com/testpoint/user/login");
try{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add( new BasicNameValuePair("password", "guest") );
nameValuePairs.add( new BasicNameValuePair("username", "guest") );
httpPost.setEntity( new UrlEncodedFormEntity(nameValuePairs));
response = httpClient.execute(httpPost);
Log.i("SEEMS TO WORK", response.toString());
Log.v("CODE", httpPost.getRequestLine().toString() + " - " + response.toString());
}catch(Exception e){
Log.e("HTTP ERROR", e.toString());
}
return response;
}
source
share