I’ve looked around several articles and nothing is like a clear cut piece of code that I can just look at and gather all the ideas. Everyone posts little segments of their app and I’m not sure what is critical to the session/login and what is essential only to their app.
The process:
- Initial login with user/pass. Password will be md5 encrypted and matched on the server end.
- If the user/pass is correct the session id from the request will be stored server-side and any future requests from the same session id will be provided the appropriate data.
What I need:
- A simple JSON request that can complete GET/POST requests. Post for the user/pass. Get for future queries.
- A section of code that will retain the session cookie and apply it to any further GET/POST requests.
My test:
I’ll try and make a request for a some information (for test purposes a string; “pass”). Without the login being confirmed my server will return “fail” after the login I’d like it to return “pass”. Then I’ll go into my database alter the session id that was stored. Refresh my app, and have it change from “pass” to “fail” again.
NOTE: A big problem I have is when people post section of code and don’t say where each section should go. Please be clear where blocks of code should go. (ie. after the initial request. As a separate function, etc.)
Example of an AMAZING answer that I ran across. Except it didn’t have any code, just structure :/
I think I found what I was looking for. I’ve decided to implement this example:
http://old.metatroid.com/articles/Android%20Development%28part%201%29%20-%20Syncing%20Cookies%20Between%20Http%20Clients%20and%20WebViews
Not sure if it’s going to do all I need, but so far it looks good. Best example I’ve found so far.