I make some android app. To log out, I must send http delete request to server. I used loopj liberary.
So, I make like this.
ConnectionInfo.java
public ConnectionInfo(Context ctx) {
this.context = ctx;
}
public void sign_out(String Url, AsyncHttpResponseHandler handler) {
CommonClient.setCookieStore(myApplication.getCookieStore());
CommonClient.delete(context, Url.toString(), handler);
}
public void sign_in(HashMap<String, String> params, JsonHttpResponseHandler handler) {
Uri.Builder requestUri = new Uri.Builder();
requestUri.scheme(SCHEME);
requestUri.authority(HOST);
requestUri.path(sign_in);
CommonClient.post(context, requestUri.toString(), params, handler);
}
CommonClient.java
public class CommonClient {
private static final AsyncHttpClient AsyncClient = new AsyncHttpClient();
public static void post(Context mContext, String actionserver,
RequestParams params, JsonHttpResponseHandler responseHandler) {
AsyncClient.post(mContext, actionserver, params, responseHandler);
}
and then
Some Activity class, call sign_in method.
connectionInfo.sign_in(params, UserLoginJsonHandler);
and Finished some work, the other Activity class call sign_out method. Like this.
connectionInfo.sign_out(url, asyncHttpResponseHandler);
But, I login another ID. Keeping login before user.
I think, different login and logout session or cookies something?
How Can I logout using loopj? How do I Fix it?
Please help me.