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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:06:32+00:00 2026-05-26T20:06:32+00:00

I am building an android app for which I need to check the sync

  • 0

I am building an android app for which I need to check the sync setting of each individual account registered in the device. I know that I can do it through ContentResolver class but I am having some problem with it. I’ve managed to get the list of all accounts on the device but I don’t know where to get the relevant authority of a specific account at run time. Below is the code:

AccountManager acm = AccountManager.get(getApplicationContext());
    Account[] acct = acm.getAccounts();
    for(int i=0;i<acct.length;i++){
        int p = ContentResolver.getIsSyncable(acct[i], null);
        Log.i(TAG,"account name is"+acct[i].name);
        Log.i(TAG,"answer to syncable is: "+String.valueOf(p));

The getIsSyncable(Account am,String authority) asks for an account and an authority. As you can see I am passing in NULL instead of the actual authority. Does anyone know of a way I can find the authority to the relevant account?

  • 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-26T20:06:33+00:00Added an answer on May 26, 2026 at 8:06 pm

    You can retrieve the known SyncAdapters and then query the ContentResolver

    AccountManager acm
            = AccountManager.get(getApplicationContext());
        Account[] acct = null;
    
        SyncAdapterType[] types = ContentResolver.getSyncAdapterTypes();
        for (SyncAdapterType type : types) {
          Log.d(TAG, "--------------------");
          Log.d(TAG, type.authority + "--" + type.accountType);
          acct = acm.getAccountsByType(type.accountType);
          for (int i = 0; i < acct.length; i++) {
            int p = ContentResolver.getIsSyncable(acct[i], type.authority);
            Log.i(TAG, "account name: " + acct[i].name);
            Log.i(TAG, "syncable: " + String.valueOf(p));
          }
        }
    

    Output:

    11-15 17:12:51.899: DEBUG/syncsample(4572):
    com.google.android.music.MusicContent–com.google 11-15 17:12:51.899:

    INFO/syncsample(4572): account name: xxxxxxxxx@gmail.com 11-15
    17:12:51.899: INFO/syncsample(4572): syncable: 1 11-15 17:12:51.899:

    INFO/syncsample(4572): account name: xxxxxx@google.com 11-15
    17:12:51.899: INFO/syncsample(4572): syncable: 0

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

Sidebar

Related Questions

I'm building a mobile web app targeting Android users. I need to know what
Just starting out on android developing. To start off, I'm building an app which
I am building an app in android in which I am supposed to let
I'm building an Android app that will stream several radio stations from a Latin
We are building a security mechanism in our Android App , for which we
I am building an Android app in which user are required to choose a
I'm building a mobile app for Android and I need to pool HTTP requests
I am building an app for the android, i dont need my app to
I am building an Android app which takes a string input and returns a
I am building an Android app in which there is a list of items

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.