问题描述
我开发了一个需要做两件事的应用:
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 的选项以进行联系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!