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

  • Home
  • SEARCH
  • 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 5943429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:23:39+00:00 2026-05-22T16:23:39+00:00

My Android application has an inactivity timeout. On a timeout, I return the user

  • 0

My Android application has an inactivity timeout. On a timeout, I return the user to the ‘Sign In’ screen which is (always) in the back stack. My SignIn class has android:launchMode="singleTop" set so the instance running in the backstack is always reused.

I start this intent on timeout:

Intent inactivityTimeout = new Intent(this, SignIn.class);
inactivityTimeout.putExtra(INTENT_EXTRA_INACTIVITY_TIMEOUT, true);
int flags = inactivityTimeout.getFlags();
flags = flags|FLAG_FROM_BACKGROUND|Intent.FLAG_ACTIVITY_CLEAR_TOP;
inactivityTimeout.setFlags(flags);

When the SignIn screen starts up, it checks for the INTENT_EXTRA_INACTIVITY_TIMEOUT Intent extra. If found, it shows a “You’ve been Signed Out” dialog. This is all working correctly.

Now I’ll get to the problem: Since it’s based on a timer, this Intent can be fired off regardless of if my application is in the foreground or background. This is desired as I wouldn’t want the app to stay logged in indefinitely just because it’s in the background.

However, when the application is in the background and the timer expires, this inactivityTimeout Intent is fired off and the application is brought back to the foreground. It’s not urgent to alert the user right now that they’ve been timed out, so I’d prefer the app stays in the background so as to not interrupt the current action.

I tried adding the FLAG_FROM_BACKGROUND flag to my Intent but the application is still brought to the foreground. I’m not certain what else to try, or if this is a problem that I should be addressing in my Intent or in my receiving activity.

Can anyone suggest a way to implement this in my Intent (or in the responding activity?). Or am I missing something conceptual here? Thanks!

  • 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-22T16:23:40+00:00Added an answer on May 22, 2026 at 4:23 pm

    There is no need to proactively revoke credentials due to age. After all, the process may well terminate before the user ever tries to reuse those credentials.

    Each activity needs to check to see if the user has valid credentials. In that check, you also check for age, and simply fail the credential check if the credentials are correct but too old. And, on a failed credential check, you bring up your login activity.

    This allows you to dump the timer.

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

Sidebar

Related Questions

I am building an android application which has a listview and when the user
I have an Android application which has a login screen. Upon the click of
In order for the user to control the volume , my android application has
I'm building an android application, which has a list view, and in the list
I have an Android application which has four tabs (I use a main TabActivity
I've created an Android application which has a certain package name that I've been
Hello I have an android application which has a service running. After 20 mins
I am currently working on an Android application which has an order form. I
I have an android application which contains four modules(I mean four apk's).Each module has
I'm develloping an android application that has a local database which synchronizes whith an

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.