This isnt specifically a programming question, more on the logic.
Basically I have a website which I am making an android app for. On the app I want the user to be able to login by entering their username and password to the prompt on the app. When the user clicks login the data is POSTED to the site URL.
This is where I am a bit lost… how then does the app know whether the login was successful or not, and, if successful, I want the app to show then another form or whatever for the user to be able to post new content to the site, which will be POSTED again. I’d imagine this involves retrieving a cookie to check for authentication? Would I have to set up a custom response page? And how would the app maintain the session?
To answer your questions:
On server side, you can RESPOND to the
POSTcommand with a value. This value can be whatever you want, including information on whether the login was successful or not.You can use a COOKIE to validate on the server side that the request comes from a valid session.
It’s not strictly necessary, but I would definitely do this.
You can store the “cookie” on a global object/variable.
—
Having answer your questions I would suggest you do a small RestFUL/HTTP/SOAP API on the server side and use that on the client (ANDROID) side. It will be easier than PARSING existing web pages.