user1206401
user1206401

Reputation: 101

Android - Getting Google Account Sync Settings

I'm trying to find out if the user has Google-Photos (picasa) set to sync on their device. Is there any way to programmatically determine whether sync is turned on for any of the google accounts set up on the user's phone?

Also, is there any way to programmatically turn synching off for Google-Photos? If not, what is the correct Intent to launch an activity directly to the Google account's "Data & Synchronization" screen, so that the user can manual disable sync?

Thanks in advance!

EDIT:

I found some code that is useful, but what is the Authority string for "Google-Photos" (aka Picasa)???

import android.provider.ContactsContract;

AccountManager am = AccountManager.get(this);
Account[] accounts = am.getAccountsByType("com.google");        
boolean syncEnabled = ContentResolver.getSyncAutomatically(accounts[0], ContactsContract.AUTHORITY);

Upvotes: 6

Views: 4631

Answers (1)

Tofeeq Ahmad
Tofeeq Ahmad

Reputation: 11975

There are two case

1) If your device is already synchronize with Google account Then Account selector will select current login account.Refer this link

2) If your account selector does not return any account that means you are not login with any Google account. So you need to synchronize.Now in this case open your account screen and one account This will help you

Upvotes: 1

Related Questions