Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

data & synchronization - manually sync mail. calender and contacts

I am trying to write an app that syncs my mail and my calender with just a single click. After looking through this forum I found some good hints and wrote a short test app that takes my first google account and starts syncing.

The code is working so far but currently only the contacts were synced!

    AccountManager am = AccountManager.get(this);
    Account[] acc = am.getAccountsByType("com.google");
    Account account = null;
    if (acc.length > 0) {
        account = acc[0];

        Bundle extras = new Bundle();
        extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
        extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);

        ContentResolver.requestSync(account, ContactsContract.AUTHORITY,
                extras);
    }

The method requestSync takes "authority" as parameter and now I use "ContactsContract.AUTHORITY" and I guess that is the reason for only synching my contacts. My question now is, does anybody know what authority string I have to use to only sync my mail and calender? If "null" is used as authority all three (cal, contacts and mail) get synched

public static void requestSync (Account account, String authority, Bundle extras)

Thanks in advance!!

like image 676
GZA Avatar asked Oct 23 '22 19:10

GZA


People also ask

What do you mean by data?

In computing, data is information that has been translated into a form that is efficient for movement or processing. Relative to today's computers and transmission media, data is information converted into binary digital form. It is acceptable for data to be used as a singular subject or a plural subject.

What is data and its example?

Data is defined as facts or figures, or information that's stored in or used by a computer. An example of data is information collected for a research paper. An example of data is an email. noun.

What is data ict?

ICT data means any information stored and processed by ICT and includes programs, text, pictures and sound whether internally or externally hosted or processed.

What are types of data?

4 Types of Data: Nominal, Ordinal, Discrete, Continuous.


1 Answers

OK, it seems the the Authority for contacts is:

"com.android.contacts"

and for calander:

"com.android.calendar"

But I could not find the String for syncing Gmail...

like image 191
GZA Avatar answered Oct 27 '22 10:10

GZA