Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).
"save it in a preferences file" - that would be extremely slow.
There might be a way to store PHP sessions, but not sure how an app behaves differently from a browser. I think sessions can be little bit more complicated with apps.
You can have the PHP page log first, and then start a session. Maybe generate a token key and store this in the database, and then return this to the android app. Android app will get this token (after parsing), and probably save it in a preferences file. This approach is basically a custom session. You will have to figure out things like expiration of token, etc.
You can send a get/post request to log on the server. The PHP page can return JSON or XML. Then your Java (Android) code will have to parse that response.
You could store it in the database, but it would make things too complicated just for one string.