如何运行与 Google 通讯录更新的同步过程?

发布于 2024-09-06 13:21:17 字数 281 浏览 4 评论 0原文

当我使用新的 google api 处理删除联系人时,我遇到了问题

这里是我的问题

以下是唯一的响应:

您必须运行同步过程,以便它与 Google 通讯录一起更新,然后它将被永久删除。检查已删除标志

那么我应该怎么做才能运行与 Google 通讯录更新的同步进程呢?

When I deal with deleting a contact using new google api, I got the problem

here is my problem

Following is the only response :

You have to run a sync process, so it updates with Google Contacts, than it will be removed permanently. Check for deleted flag

So what should I do to run a sync process which updates with Google Contacts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不气馁 2024-09-13 13:21:17

此方法可以解决您的问题。但你必须已经设置了你的帐户。

private void requestSync()
{
    AccountManager am = AccountManager.get(this);
    Account[] accounts = am.getAccounts();

    for (Account account : accounts)
    {
        int isSyncable = ContentResolver.getIsSyncable(account, ContactsContract.AUTHORITY);

        if (isSyncable > 0)
        {
            Bundle extras = new Bundle();
            extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
            ContentResolver.requestSync(accounts[0], ContactsContract.AUTHORITY, extras);
        }
    }
}

This method could resolve your probromm. but you must have set your account.

private void requestSync()
{
    AccountManager am = AccountManager.get(this);
    Account[] accounts = am.getAccounts();

    for (Account account : accounts)
    {
        int isSyncable = ContentResolver.getIsSyncable(account, ContactsContract.AUTHORITY);

        if (isSyncable > 0)
        {
            Bundle extras = new Bundle();
            extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
            ContentResolver.requestSync(accounts[0], ContactsContract.AUTHORITY, extras);
        }
    }
}
温柔戏命师 2024-09-13 13:21:17

如果您尝试删除您自己的联系人(即您放入联系人提供程序中的内容),那么只有您与自己的服务器同步后才会删除该联系人,然后服务器应删除该行永久。联系人提供程序旨在执行此操作,以确保同时删除该行的服务器版本和客户端版本。

您对原始问题的答复是错误的。 没有与 Google 通讯录同步。您只能控制与您自己的服务器的同步。 Google 通讯录服务器有自己的同步适配器,如果用户选择与 Google 通讯录同步,该适配器就会被激活。

如果您删除正在与 Google 通讯录同步的内容,那么它将保持“不可见”状态,直到下次同步,此时它将被永久删除。联系人提供程序将自动采取行动,就好像该事物不存在一样。如果您看到它,则意味着您在联系人提供程序中执行了错误的操作。您看到的联系人中可能有一行未正确删除。

If you're trying to delete your own contact, that is, something you put into the Contacts Provider, then it won't be deleted until you sync with your own server, which should then delete the row permanently. The Contacts Provider is designed to do this, to ensure that both the server and client version of the row are deleted at the same time.

The response you got to your original question was mistaken. You don't sync with Google Contacts. You only control the sync with your own server. The Google Contacts server has its own sync adapter that's activated if the user chooses to sync with Google Contacts.

If you delete something that's being synced with Google Contacts, then it will remain "invisible" until the next sync, at which point it will be permanently removed. The Contacts Provider will automatically act as if the thing doesn't exist. If you're seeing it, it means that you're doing something incorrectly in the Contacts Provider. There may be a row attached to the contact you're seeing that's not been deleted correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文