I am creating HttpClient as follow and using it for all my Posts and Gets methods.
HttpClient hc=createHttpClient();
public static HttpClient createClient() {
HttpParams params = new BasicHttpParams();
params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET,HTTP.DEFAULT_CONTENT_CHARSET);
params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, true);
params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 36 * 1000);
params.setParameter(CoreConnectionPNames.SO_TIMEOUT, 40 * 1000);
SchemeRegistry schReg = new SchemeRegistry();
schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);
return new DefaultHttpClient(conMgr, params);
}
I am using this httpclient as,,,
ApplicationClass ac=(ApplicationClass)getApplication(); ac.hc;
This client works perfect when app is open. But when i remove app from backstack i also want to use same httpclient when reopen . How to achieve this ?
Flow is like.:
App open -> User log in -> ...Some Operations... -> user closes app without logout
now if user reopens app then , here i should be able to connected with http client.. how to handle this?