6

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);
user1206401
  • 101
  • 2
  • 7

1 Answers1

1

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

Community
  • 1
  • 1
Tofeeq Ahmad
  • 11,935
  • 4
  • 61
  • 87
  • 2
    thanks for the tip, but it did not really address my question. I know how to enumerate the available accounts on the device. My question is how to access specific sync settings for each google account. For example, if you set up your google account on your phone, you can choose to individually sync gmail, calender, contacts, books, photos etc. I want to check the sync setting specifically for google photos (aka picasa) on each google account registered on the device. Then, if sync is turned on for google-photos, i want to programmatically turn it off. – user1206401 May 02 '12 at 08:00
  • Do you know how access picasa album, gmail , calender? you need to implement api for these and then you have to login with gmail as these need authentication – Tofeeq Ahmad May 02 '12 at 08:06
  • 1
    Calendar sync settings can be accessed via CalendarContract.Authority and the code pasted in my question. Contacts sync settings can be accessed similarly via ContactsContract.Authority. Is there something similar for Google-Photos? What's the Authority string? – user1206401 May 02 '12 at 08:14