数据&安培;同步 - 手工同步邮件。日历和联系人 [英] data & synchronization - manually sync mail. calender and contacts

查看:146
本文介绍了数据&安培;同步 - 手工同步邮件。日历和联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个应用程序同步我的邮件和我的日历只是一个单一的点击。细算通过这个论坛上,我发现了一些很好的提示,写了一个简短的测试应用程序,需要我的第一个谷歌帐户,并开始同步。

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.

在code是工作至今,但目前只有接触者同步!

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);
    }

该方法requestSync以权威的参数,现在我用ContactsContract.AUTHORITY,我想这是唯一的假唱我交往的原因。 我现在的问题是,没有任何人知道我有什么权力字符串使用只同步我的邮件和日历? 如果空作为权威的所有三(CAL,联系人和邮件)得到同步的

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!!

推荐答案

OK,看来管理局联系人是:

OK, it seems the the Authority for contacts is:

"com.android.contacts"

及压延:

"com.android.calendar"

但我无法找到字符串进行同步Gmail的...

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

这篇关于数据&安培;同步 - 手工同步邮件。日历和联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆