Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Getting Google Account Sync Settings

Tags:

android

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);
like image 355
user1206401 Avatar asked May 02 '12 06:05

user1206401


1 Answers

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

like image 116
Tofeeq Ahmad Avatar answered Nov 12 '22 14:11

Tofeeq Ahmad