How to logout of android app after particular time?
<p>I'm building an android app which has a login and logout option. How do I make the app go back to login screen if the user has logged in and not used it(or kept idle) for some time(say 10min)? Also, how do I check for multiple logins? Please note that my app uses an external database(mysql). I did this using php code. Also, how do I check for multiple logins(I've multiple users) from mysql and allow each user to log in? </p>

<p>This is my code for authentication:</p>

<pre><code>try
{
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://10.0.2.2/user_validate.php");
    HttpResponse response = httpclient.execute(httppost);
    HttpEntity entity = response.getEntity();
    InputStream inputStream = entity.getContent();

    byte[] data = new byte[256];

    buffer = new StringBuffer();
    int len = 0;
    while (-1 != (len = inputStream.read(data)) )
    {
        buffer.append(new String(data, 0, len));
    }

    inputStream.close();
}
catch (Exception e)
{
    Toast.makeText(Login.this, "error"+e.toString(), Toast.LENGTH_LONG).show();
}

if(buffer.charAt(0)=='Y')
{
    Intent intent = new Intent(getApplicationContext(), 
        Home.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    finish();
    startActivity(intent);
}
</code></pre>
