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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:14:32+00:00 2026-05-22T02:14:32+00:00

I have the following code that is getting all the gmail id’s that are

  • 0

I have the following code that is getting all the gmail id’s that are synchronized with my phone but i want the Main gmail id that user register the first time. Because all the other gmail accounts(not main) if i want i can delete anytime but to delete the main account we have to done other things too, So that’s why i want to get the main account to use into my application.

here’s my code i think to add some filter in it, i can do that but can’t able to get the thing correctly.

Account[] accounts=AccountManager.get(this).getAccountsByType("com.google");
    for(Account account: accounts)
    {
        String possibleEmail=account.name;
        Log.d("Possible email id's of user", possibleEmail);
    }

i already seen Roman link but didn’t able to convert it in right manner.
I want to use this main email id for push notification using C2DM from google.

  • 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-22T02:14:33+00:00Added an answer on May 22, 2026 at 2:14 am

    I have an answer, but it was not a correct way to do it. As i am getting all the accounts associated with google(gmail) and as we enter the email id’s to be synchronized with gmail a stack is created and on 0th position, I am getting the primary Gmail id that was first enter by the user when he switched ON his phone.

        Account[] accounts=AccountManager.get(this).getAccountsByType("com.google");
        String myEmailid=accounts[0].toString();
        Log.d("My email id that i want", myEmailid);
        for(Account account: accounts)
        {
            String possibleEmail=account.toString();
            Log.d("Possible email id of user", possibleEmail);
    
        }
    

    If someone has a better solution then let me know, i tested this example on 2 phones and it works fine, but i see many applications that are fetching the primary email id of users to send email and all, i want to know how they are doing?

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

Sidebar

Related Questions

I have the following code that loads a user's Active Directory DirectoryEntry object from
I have the following code in a view controller that (in all other respects)
I have following code that does not work due to a being a value
I have following code snippet that i use to compile class at the run
I have the following code that shows either a bug or a misunderstanding on
I have the following code that won't compile and although there is a way
I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl(locale)).SelectedValue; HttpCookie
I have the following code that creates two objects (ProfileManager and EmployerManager) where the
I have the following code that I need to add an additonal object to
I have the following code that creates a serverside object of the xmlhttp class.

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.