我已经成功地设置了一个登录到我的drupal网站的Android应用。Drupal Android应用登录持久性
我的问题是登录的用户会话不会持续很长时间。该网站清楚地显示我的用户已登录到该网站,但在一个小时左右,用户不再在网站上显示为活动状态。 (我猜是因为我并不完全知道它。)
任何人都可以提供一个洞察,为什么发生这种情况?
的代码如下:
protected HttpResponse doInBackground(Void... params) {
// TODO Auto-generated method stub
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://mystestsite.com/testpoint/user/login");
// TODO Auto-generated method stub
try{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("password", "guest"));
nameValuePairs.add(new BasicNameValuePair("username", "guest"));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
//Execute HTTP post request
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;
}
我认为这取决于会话cookie是由Drupal设置多长时间。你还应该发布一些代码。 – 2011-05-29 11:58:38
嗨卢卡斯Knuth, 我一直在这里发布一些代码,但它只是不会工作 – sisko 2011-05-29 23:22:01
只需将代码发布在编辑器字段中,将其标记并按代码标签... – 2011-05-30 11:43:15