HTC 设备上的联系人应用程序设置中未显示帐户

发布于 2024-10-06 03:49:26 字数 181 浏览 0 评论 0 原文

我根据SDK中的示例编写了自己的SyncAdapter。它应该添加来自外部源的联系人,并且它在设备模拟器中完美运行。但是,当我在 HTC Desire 上运行它时,我在“联系人”->“显示选项”中看不到我的帐户

。此外,我在 Desire 上尝试了 google 的示例,但也无法在此列表中看到它们。有谁知道有什么解决办法吗?

I write my own SyncAdapter based on example in SDK. It should add contacts from external source, and it works perfect in device emulator. But when I run it on HTC Desire after all I can't see my Account in Contacts->Display options

Also I tried google's example on Desire and couldn't see them in this list too. Does anyone know any solution?

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

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

发布评论

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

评论(2

夜司空 2024-10-13 03:49:26

我通过让我的帐户默认可见来解决这个问题。

ContentProviderClient client = getContentResolver().acquireContentProviderClient(ContactsContract.AUTHORITY_URI);
ContentValues values = new ContentValues();
values.put(ContactsContract.Settings.ACCOUNT_NAME, account.name);
values.put(ContactsContract.Settings.ACCOUNT_TYPE, account.type);
values.put(ContactsContract.Settings.UNGROUPED_VISIBLE, true);
try
{
  client.insert(Settings.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build(), values);
}
catch (RemoteException e)
{
  e.printStackTrace();
}

之后该帐户默认可见,您可以在联系人的帐户列表中看到它

I solve it by making my account visible by default.

ContentProviderClient client = getContentResolver().acquireContentProviderClient(ContactsContract.AUTHORITY_URI);
ContentValues values = new ContentValues();
values.put(ContactsContract.Settings.ACCOUNT_NAME, account.name);
values.put(ContactsContract.Settings.ACCOUNT_TYPE, account.type);
values.put(ContactsContract.Settings.UNGROUPED_VISIBLE, true);
try
{
  client.insert(Settings.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build(), values);
}
catch (RemoteException e)
{
  e.printStackTrace();
}

after that account is visible by default, and you can see it in accounts list in contacts

她如夕阳 2024-10-13 03:49:26

要使您的帐户在标准联系人应用程序的“显示选项”中可见,您应该拥有 SyncAdapter< /code> 在您的应用程序中,它是在 syncadapter.xml 中指定的元数据,如 此处

此外,您应该指定使用 android.permission.WRITE_SYNC_SETTINGS AndroidManifest.xml 中的权限。

UNGROUPED_VISIBLE 使其仅对联系人组列表可见。

To make your account visible in "Display options" of standard Contacts application you should have SyncAdapter in your application and it's meta-data specified in syncadapter.xml as described here.

Moreover you should specify using of android.permission.WRITE_SYNC_SETTINGS permission in AndroidManifest.xml.

UNGROUPED_VISIBLE make it visible only for list of contacts groups.

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