每当有新联系人添加到联系人时,如何添加类似于联系人的选项的WhatsApp [英] How to add whatsapp like options to contact whenever the is a new contact added to Contacts
问题描述
我开发的应用程序需要做两件事:
I develop an app which needs to do 2 things:
- 创建一个用户帐户(如WhatsApp).
- 每当有新的联系人条目时,如果该联系人正在使用我的应用程序,则立即在联系人"应用程序中的联系人详细信息页面中显示呼叫"或消息"选项.
推荐答案
您需要创建一个SyncAdapter
,这基本上是一种能够与服务器同步联系人的服务,就像Google
对于Google Contacts
,您可以将其设置为在添加新联系人时得到通知,并让您的SyncAdapter
将所需信息添加到该联系人中,以便显示到您应用程序的链接.
You need to create a SyncAdapter
, this is basically a service that is able to sync contacts to/from a server, like Google
does for Google Contacts
, you can set it to be notified when a new contact is added, and have your SyncAdapter
add the needed info to the contact so it'll show links to your app.
如果您转到手机设置>帐户,则可以在其中看到Whatsapp
和Google的SyncAdapters
,可以在其中关闭/打开它们.
If you go to your phone settings > accounts, you can see Whatsapp
and Google's SyncAdapters
there, where you can turn them off/on.
要创建同步适配器,您可以按照官方文档进行操作,或此高级教程.
To create a sync adapter, you can follow the official docs, or this great tutorial.
这篇关于每当有新联系人添加到联系人时,如何添加类似于联系人的选项的WhatsApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!