I am trying to get User data from a database, and display it on an account page in my app. In my php, I am storing the logged in user in a session. I found out that to access the user session I have to add the sessionId to my string request like:
private void getUserData() {
SharedPreferences sharedPreferences = getSharedPreferences(Config.sharedPref, Context.MODE_PRIVATE);
String sessionId = sharedPreferences.getString(Config.SID, "SessionID");
StringRequest stringRequest = new StringRequest(Request.Method.GET, Config.SERVER_ADDRESS + "GetUserData.php?PHPSESSID=" + sessionId,
new Response.Listener<String>() {
with sessionId being added to the request. However I am getting an unexpected response code 500 error and I believe it has to do with managing cookies. I am trying to do something like
CookieManager manager = new CookieManager();
CookieHandler.setDefault(manager);
but not sure how to do this or where to put the cookie manager in the method. Thank you.