我可以扩展 Android 联系人数据库吗?
我想知道是否可以扩展 Android 联系人数据库?
从这里 - http://d.android.com/reference/android/provider/ContactsContract.html
它说:
ContactsContract 定义了一个可扩展的 联系人相关数据库 信息
可扩展会建议我,我可以在正常值(例如姓名、号码、电子邮件、工作号码、家庭号码等)之外向联系人应用程序添加更多数据。
但是,此页面的示例 - http://d.android.com/reference/android/provider/ContactsContract.RawContacts.html仅显示如何插入标准值(如姓名),而不是如何向联系人添加新字段。
此外,在网络上搜索并没有找到太多关于扩展联系人数据的信息。
所以我想知道这是否可能,或者可扩展是否指的是联系人的其他部分?
例如,我想为在我的应用程序中具有特殊权限的联系人添加一个附加字段,以便当用户查看联系人时,他或她知道他们可以与哪些用户一起使用我的应用程序。
这可能吗?
I was wondering is it possible to extend the Android Contacts database?
From here - http://d.android.com/reference/android/provider/ContactsContract.html
It says:
ContactsContract defines an extensible
database of contact-related
information
Extensible would suggest to me that I can add in more data to the contacts application outside the normal values such as Name, number, email, work number, home number etc..
However the examples of this page - http://d.android.com/reference/android/provider/ContactsContract.RawContacts.html only show how to insert the standard values like name and not how to add a new field to a contact.
Furthermore a search on the web does not turn up much information on extending the contacts data.
So I was wondering is it even possible or does the extensible refer to some other part of the contacts?
For example I would like to add in an additional field for contacts that have special privileges within my app so when a user looks at the contacts he or she knows what users they can use my app with.
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将自定义数据存储在联系人数据库中。但是,如果您认为用户在使用内置 Android 联系人时能够看到您插入的自定义数据,那么“当用户查看联系人时,他或她就知道他们可以与哪些用户一起使用我的应用程序”,这可能是不可能的应用。您必须在自己的应用程序中显示自定义数据。
ContactsContract.Data 类的 javadoc 应该提供解释,以及联系人文章。
要使用此功能,您需要通过查询 RawContacts 来获取原始联系人 ID 。
这里有一些示例代码可能会帮助您开始...
You can store custom data in the contacts database. However "when a user looks at the contacts he or she knows what users they can use my app with," may not be possible if you are thinking users will be able to see the custom data you inserted while using the built-in Android Contacts application. You would have to display the custom data in your own application.
The javadocs for the ContactsContract.Data class should provide an explanation, as well as the Contacts article.
To use this you'll need to get a raw contact id by querying the RawContacts.
Here some example code that might help you get started...