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 8896841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:10:50+00:00 2026-06-15T00:10:50+00:00

I’m currently building out a ICS 4.0+ Android app that will require authentication. The

  • 0

I’m currently building out a ICS 4.0+ Android app that will require authentication. The issue I’m having is handling checking for login status when:

  • User first opens the app
  • User returns to app after closing (resuming)

The behavior I’m looking for is that there is a “loading…” splash screen if the app is removed from memory and reopened, and then an almost unnoticeable splash screen when the user returns to app upon resuming (still in memory).

The code I currently have for checking this is:

    public static void checkUserStatus(Context context, boolean isPassive) {
    Log.d(TAG, "Checking user status..");
    // User is logged in and has cc
    if ( APIUtil.isLoggedIn() && UserAccount.getCreditCards().size() > 0 && isPassive == false) {
        Intent intent = new Intent(context, OtherActivity.class);
        context.startActivity(intent);
    // User is logged in but has no cc
    } else if (APIUtil.isLoggedIn() && UserAccount.getCreditCards().size() == 0) {
        Intent intent = new Intent(context, ManageCCActivity.class);
        context.startActivity(intent);
    // User is not logged in
    } else if(isPassive == false) {
        Intent intent = new Intent(context, HomeActivity.class);
        context.startActivity(intent);
    }
}

checkUserStatus is called in onResume() of every activity. The idea being that it’ll check this and redirect accordingly, but the behavior is wacky and inconsistent and it just feels janky.

Are there any examples of authentication flow out there? Ideas? Suggestions?

  • 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-06-15T00:10:52+00:00Added an answer on June 15, 2026 at 12:10 am

    A pattern that I’ve used and seen other use that works well looks something like this:

    • Encapsulate the logic you have for determining if the user is logged in and has valid data into a Service, and then run that Service bound (meaning you never start or stop it, you bind to it…docs link for more on that).
    • Implement a base Activity implementation that binds to the service in onStart() and unbinds froms it in onStop(). This allows the Service to stay running as you move from one Activity to another. Have any Activity that needs access to this information inherit from this base (which may be every Activity).
    • Have the Service check the information it needs to only when it starts up, and call back with the results.

    What this creates is a (fairly) single instance of checking for authorization that only checks when the application starts up or the user returns after leaving it, without constantly checking as you move from one Activity to another. It also allows it to gracefully finish any long-running operations if the user leaves prematurely since all the work is being done in a Service.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am currently running into a problem where an element is coming back from
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

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.