Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6701181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:54:10+00:00 2026-05-26T06:54:10+00:00

I guess, I have a generic logic problem. I want to logout a user

  • 0

I guess, I have a generic logic problem. I want to logout a user after 15 if there is no activity. How do I find any “activity” in android. How should I go about it…

Experts please help…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:54:12+00:00Added an answer on May 26, 2026 at 6:54 am

    You’ll need to invest a little thought into exactly what your requirements are here, but from what I can tell, you want to keep track of the user interactions and if a time limit expires since the last interaction, perform some action, in your case logging them out of your application.

    Firstly, you’ll need some place that you can track when the last interaction occured, since you’ll want this to be application wide you could use a singleton to hold this, or override the Application class, either way should do.

    Next, you’ll need to start tracking user interactions. From your activities, you can override the onUserInteraction method, this gets invoked anytime the user interacts with the application such as key event. Each time you hit this method, update your singleton and let it know something has happened, with a timestamp.

    Finally, you’ll need some kind of looping check to constantly check if anything has happened recently. Theres various was of doing this, you could have a continuous loop that compares current timestamp to the last recorded event, a bit of draft code :

    while(true)
    {
       if (timeLastEventRecorded < (now - 15))
       {
          //nothing has happened in 15 minutes, so take corrective action
       }
    }
    

    Presumably you’ll already have some code in your application that takes care of logouts, such as when the user clicks “logout”, you should just be able to invoke that in the sample above.

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A fairly simple question for which I have a guess, but I can't find
I want to have a generic PHP function that builds a mysql query based
I guess this question could be taken in two ways... (Generic) - is there
I guess I have been using the Web Site model ever since .NET 2.0
I have a HashMap (although I guess this question applies to other collections) of
I guess no one will have a definative answer to this but considered predictions
We have been using Rational Rose 2000 or so for modeling since i guess
I guess this is kind of an odd question but I have tried setting
I guess the topic says it. I have tried googling this, but havent gotten
I guess it is impossible, but I will ask it anyway. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.