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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:22:57+00:00 2026-06-05T04:22:57+00:00

I am developing an application which needs a Google account for certain options. Options

  • 0

I am developing an application which needs a Google account for certain options.
Options are disabled when no account is detected, but I am presenting the user to add one by asking via a popup, if user clicks yes, the activity should start.
It’s working fine to display the global “Add account” page, but I want to skip that uncalled for extra step. After all, why present someone with the option to add a Exchange account if a Google account is needed, that’s just confusing. So I want to default to the new Google account setup page.

Java

try {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    intent.setClassName( "com.google.android.gsf", "com.google.android.gsf.login.AccountIntroActivity");

    //if(getApplicationContext().getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
        getApplicationContext().startActivity(intent);
    //} else {
        //getApplicationContext().startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    //}
} catch ( ActivityNotFoundException e) {
    e.printStackTrace();
}

When I run this, the following exeception is thrown:

05-29 18:24:50.741: W/System.err(10875): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.gsf/com.google.android.gsf.login.AccountIntroActivity}; have you declared this activity in your AndroidManifest.xml?

Androidmanifest.xml

    <activity 
        android:name="com.google.android.gsf.login.AccountIntroActivity"/>   

QUESTION: what am I missing here?

EDIT:

I tried a different way using addAccount, this doesn’t work, nothing happens, no errors are thrown, no new activity starts to add the Google account. By the way, the entire try catch block in the original version is in a AlertDialog/ listener.

AccountManager acm = AccountManager.get();
acm.addAccount("com.google", null, null, null, null, null, null);           
  • 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-05T04:22:59+00:00Added an answer on June 5, 2026 at 4:22 am

    Ok, the problem using the AccountManager way was that the Activity context not being used by me in the method call at all, or not correctly. Given the fact it was used in a DialogInterface, this works:

    private void popup() {
         AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this);
         helpBuilder.setTitle("Add Gmail account");
         helpBuilder.setMessage("These options rely on a Gmail account, but you 
         don't seem to have one configured. Would you like to configure one now?");
    
         helpBuilder.setPositiveButton("Yes",
         new DialogInterface.OnClickListener() {
             //@Override
             public void onClick(DialogInterface dialog, int which) {
                 //try/ catch block was here
                 AccountManager acm = AccountManager.get(getApplicationContext());
                 acm.addAccount("com.google", null, null, null, thisclassname.this, 
                 null, null);
                }
         });
    
         helpBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                 // close the dialog, return to activity
             }
         });    
    
         AlertDialog helpDialog = helpBuilder.create();
         helpDialog.show();
    }//end method
    

    This probably needs some more work to be able to actually use the configured account name, but for now, this answers the Q.

    Sadly, this requires a permission, but I guess that’s just how things are

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

Sidebar

Related Questions

I'm developing application which need access to user's facebook account. It is working, but
I am developing one application which needs the gmail user authentication? How can I
We're in process of developing a desktop application which needs to record user's screen
I am developing an application which needs the current date from the device, but
I'm developing an application which needs to interact with Video4Linux abstraction. The application is
We are developing an application which needs to deal with some non-trivial amount of
I'm developing an application which needs to store large amounts of data. I cannot
My team and I are in the middle of developing an application which needs
I am developing an Android application which needs to access QuickPay's service ( https://secure.quickpay.dk/form
I am developing an application in cocoa,which needs to check whether that app is

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.