【问题标题】:How to open an app via a link sent through SMS如何通过通过 SMS 发送的链接打开应用程序
【发布时间】:2018-11-06 21:00:36
【问题描述】:

我有一个 React 原生 Android 应用,我想从通过 SMS 发送的链接(深度链接)打开它。

我在网上进行了研究,并在 AndroidManifest 文件中添加了以下内容 - (Application/Activity)。

 <intent-filter android:label="filter_react_native">
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />
          <data android:scheme="xxxxnativeapp" android:host="createpassword" /> 
 </intent-filter>

有没有什么方法可以通过从一部手机向另一部手机发送带有链接的短信来测试这一点。如果是这样,我如何创建可以作为 SMS 发送的链接 xxxxnativeapp://createpassword 只是为了测试。这应该会打开应用程序。

只是为了测试,我尝试创建一个 Native android 应用程序,以便在文本视图中有一个 href,它会打开一个 URL 而不是应用程序。我认为从另一个应用程序打开一个应用程序与 从链接打开应用程序。如果我错了,请纠正我。

我也尝试通过 gmail 发送xxxxnativeapp://createpassword,但我没有成功,因为如果我以这种方式发送,gmail 会删除链接。

抱歉,我太新了,所以想知道是否有人尝试从作为 SMS 发送的链接打开应用程序。

请建议我如何测试它。

谢谢 回复

【问题讨论】:

    标签: android react-native sms react-native-android deep-linking


    【解决方案1】:

    这样做的唯一方法是使链接看起来像一个 URL,这很容易做到。只需将方案更改为http

    <data android:scheme="http"
          android:host="xxxxnativeapp"
          android:pathPrefix="/createpassword" />
    

    现在您可以使用http://xxxxnativeapp/createpassword 作为可点击链接

    这在 iOS 上是不可能的

    【讨论】:

      猜你喜欢
      • 2022-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多