繁体   English   中英

如何使用默认的现有 URL Schema tel 为电话自定义拨号器注册反应原生移动应用程序

[英]How to register a react native mobile app with the default existing URL Schema tel for telephone custom dialer

我们团队的目标是在手机上安装一个客户拨号器应用程序,b/c 我们想为我们的用户屏蔽电话号码。 他们不希望来电显示上有他们的个人真实号码。 我们有一个电话服务在后台执行此操作(Twilio),但需要让我们的本机应用程序注册为响应“tel”URL Schema 并连接到 React Native Deep LInk API。

https://reactnative.dev/docs/linking#built-in-url-schemes

我们已经设置并遵循了自定义 URL 模式的常规教程,例如“myawesomeapp:/phone/+12223334444”,我们可以打开它。

但是,当我们无法控制设置此自定义 url 时,我们希望应用程序注册为主拨号器应用程序。 因此,只要有 +12223334444 的链接,我们希望操作系统在用户单击此链接时提供我们的应用程序而不是主电话应用程序。

有这方面的教程吗? 如何使用 React Native 在 Android 和 iOS 中执行此操作。 我们从 expo 默认反应原生项目开始,但将其弹出并完全控制原生设置。 谢谢!

本教程很有用或自定义架构,但不是“tel” https://rossbulat.medium.com/deep-linking-in-react-native-with-universal-links-and-url-schemes-7bc116e8ea8b

有同样的问题。 我将这些意图过滤器添加到 AndroidManifest 文件中

<intent-filter>
    <action android:name="android.intent.action.DIAL" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.CALL_BUTTON" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:mimeType="vnd.android.cursor.dir/calls" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <action android:name="android.intent.action.DIAL" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="tel" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="*ashnamoon.ir" android:path="tel/*" android:pathPrefix="/"/>
    <data android:scheme="http" android:host="*ashnamoon.ir" android:path="tel/*" android:pathPrefix="/"/>
    <data android:scheme="ashnamoon" android:host="*ashnamoon.ir" android:path="tel/*" />
  </intent-filter>

单击下面的链接将建议我的应用程序,您可以使用 Linking API of react-native 获取数据,您可以在此处阅读。

<a href="https://www.ashnamoon.ir/tel/091139660">test this link https</a>
<a href="http://www.ashnamoon.ir/tel/09113966092">test this link http</a>
<a href="tel:09113966091">test this phone</a>
<a href="https://ashnamoon.ir/tel/09113966090">test this link https</a>
<a href="http://ashnamoon.ir/tel/09113966092">test this link http</a>
<a href="ashnamoon://www.ashnamoon.ir/tel/09113966093">test this link ashnamoon</a>

我添加了一些对我有帮助的链接。 这只会解决 android 上的问题,但不确定如何在 ios 中完成

https://developer.android.com/reference/android/content/Intent https://android.googlesource.com/platform/packages/services/Telecomm/+/a06c9a4aef69ae27b951523cf72bf72412bf48fa/AndroidManifest.xml

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM