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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:28:47+00:00 2026-06-05T03:28:47+00:00

I have a few doubts about the Android architecture when dealing with authentication. Suppose

  • 0

I have a few doubts about the Android architecture when dealing with authentication.

Suppose I call AccountManager.getAuthToken for a particular account I need to authenticate. Let’s say that authentication fails due to bad password. The AbstractAccountAuthenticator contract requires the authenticator to return a Bundle with the Activity that handles username/password input via KEY_INTENT.

My question is: who is supposed to show the UI? Does Android automatically detect that KEY_INTENT is present and run the UI or does my code have to startActivity with the intent embodied in the AccountManager‘s response? The same applies to AccountManager.addAccount which bundles the result through a Future interface.

Where can I find some tutorials on these topics?

Thank you

  • 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-05T03:28:48+00:00Added an answer on June 5, 2026 at 3:28 am

    The system doesn’t automatically show the activity when KEY_INTENT is present.
    It’s up to you to start that activity.

    Here’s some sample code:

    private AccountManagerCallback<Bundle> mAccountManagerCallback = new AccountManagerCallback<Bundle>() {
    
        public void run(AccountManagerFuture<Bundle> future) {
    
            Bundle bundle;
            try {
    
                bundle = future.getResult();
                //if an intent was sent, start the required activity
                if (bundle.containsKey(AccountManager.KEY_INTENT)) {
                    Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT);
    
                    //clear the new task flag just in case, since a result is expected
                    int flags = intent.getFlags();
                    flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
                    intent.setFlags(flags);
    
                    startActivityForResult(intent, REQUEST_CODE_AUTH);
    
            } else {
                //otherwise, just get the credentials
                if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
                        String authToken    = bundle.getString(AccountManager.KEY_AUTHTOKEN);
                        String userMail     = bundle.getString(AccountManager.KEY_ACCOUNT_NAME);
                        //use the credentials
                }
            }
          }
          catch(...) {
            ...
            //handle errors, maybe retry your getAuthToken() call
          }
        }
    }
    

    I hope this is what you were looking for, but in case I did not understand your question correctly, please clarify.

    Cheers!

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

Sidebar

Related Questions

I have a few doubts about this robots file. User-agent: * Disallow: /administrator/ Disallow:
I have few doubts about maximum execution time set in php.ini. Assuming max_execution_time is
I have a few doubts about transaction receipt verifications: why is an external server
I have a few doubts regarding exception handling in iPhone. Here are they: Suppose
I have few doubts. Is it possible for Android application after installation, to ask
I have seen the following question but I still have a few doubts. Sending
Few basic doubts I have: 1. Is primary key column automatically indexed? 2. What
I have few questions about using lock to protect my shared data structure. I
I have few text and excel file, from which I need to import data
I have a few questions about endian-ness that are related enough that I warrant

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.