In need my application to login and keep the same session id until i logout. in mij login i use this:
public class loginTask extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
String loginData = params[0];
String text = "";
BufferedReader reader = null;
// Send data
try {
// Defined URL where to send data
URL url = new URL(URL);
// getting cookies:
URLConnection conn = url.openConnection();
conn.connect();
// setting cookies
cookieManager.setCookies(url.openConnection());
cookieManager.storeCookies(conn);
}
when the application is automatically logged in, it needs to send some data to a different URL:
Public class sendVisumNo extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
String visumNo = params[0];
String text = "";
BufferedReader reader = null;
// Send data
try {
// Defined URL where to send data
URL send_visum_url= new URL(SEND_VISUM_URL);
// getting cookies:
conn = loginURL.openConnection();
conn.connect();
// setting cookies
cookieManager.setCookies(loginURL.openConnection());
cookieManager.storeCookies(conn);
}
How can i give the SEND_VISUM_URL the same cookie/session id as the first one? until i logout
Any help would be greatly appreciated!