title: Creating a PHP backend to Android Application
body: <p>I am in progress of creating an Android Application which should have ability to share content with other users and I am planning to use PHP backend.</p>
  
  <p>I want users to log in to my web service to avoid trolling and filling my service with useless data.</p>
  
  <p>But now that I am using Android to access the service, I know its simple to create a HTTP post and send the login credentials to server but how to keep the session alive?</p>
  
  <p>As far as I know its common to just keep the application logged in to the service with mobile phone, at least when there's no personal data available.</p>
  
  <p>How should I store the data that Android device has been logged in?</p>
  
  <p>Lets say I created a MySQL table that would contain the user, password and id.</p>
  
  <p>I thought about generating unique id for the device, using ANDROID_ID or IMEI and associate it with the user id that has been logged in my web service, but that doesn't seem secure enough.</p>
  
  <p>How does other applications do this?</p>