React Native:向本机联系人应用程序添加自定义应用程序功能 [英] React Native: Add custom application functionality to Native Contacts Application

查看:31
本文介绍了React Native:向本机联系人应用程序添加自定义应用程序功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试对此进行一些研究,但似乎不断收到 Whatsapp 常见问题解答.

I have tried doing some research around this, but seem to keep getting Whatsapp FAQ's.

当我在 Android 设备上安装 Whatsapp 时,然后

When I install Whatsapp on my Android device, then

  • 转到我的 Android 联系人列表.
  • 选择一个用户.

我在联系人上获得了 Whatsapp 徽章,并且有 callmessage 操作,但我的应用中可能需要不同的用例.我如何在 React Native 上实现这一点?在iOS上有可能吗?

I get a Whatsapp Badge on contacts, and there is call or message action, but may need a different use case in my app. How do I achieve this on React Native? Will it be possible on iOS?

我想这可能是因为 Facebook 使用 RN 进行开发吗?

I imagine its possible since Facebook uses RN for development?

(编辑)

我进行了一些挖掘并注意到,如果我有多个聊天应用程序并查看链接的联系人",它会将所有聊天应用程序显示为每个用户在其平台上的链接联系人,不确定这是否提供了更清晰的信息.

I did some digging and noticed that in he event I have multiple chat apps and view "Linked Contacts" its shows all the chat apps as linked contacts of each user on their platforms not sure if this provides more clarity.

他们是否只是在搜索我的联系人列表并将该联系人链接到他们拥有的同一联系人副本?如果是这样,我将如何做到这一点?

Are they just searching my contact lists and linking that contact to the same copy of the contact they have? If so how would I do this?

推荐答案

这与 RN 无关.

您的 RN 应用需要包含一些 Java 组件来支持此功能,包括 SyncAdapter.

Your RN app will need to include some Java components to support this, including a SyncAdapter.

基本上,您需要查看设备上现有的联系人列表,对于您希望向其添加自定义操作的每个联系人,您将为您的应用创建一个新的 RawContact 并将其与现有联系人聚合,以便将添加到现有的.

Basically you need to go over the existing list of contacts on the device, and for each contact you wish to add custom-actions to, you'll create a new RawContact for your app and aggregate it with the existing contact so it'll be added to the existing one.

新的 RawContact 需要包含自定义 mimetype 操作,以及对联系人应用程序的说明,说明如何呈现您的自定义操作以及单击它时要启动的意图,请参阅以下资源:

That new RawContact needs to include custom mimetype actions with instructions to the contacts app how to present your custom action and which intent to launch when it's clicked, see the following resources:

  1. https://stackoverflow.com/a/42642971/819355
  2. https://stackoverflow.com/a/42005334/819355
  3. https://developer.android.com/training/sync-适配器/创建同步适配器
  4. http://blog.udinic.com/2013/07/24/write-your-own-android-sync-adapter/
  5. http://blog.udinic.com/2013/04/24/write-your-own-android-authenticator/

这篇关于React Native:向本机联系人应用程序添加自定义应用程序功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆