【问题标题】:How can I open my React Native App from the browser?如何从浏览器打开我的 React Native 应用程序?
【发布时间】:2018-09-20 09:18:16
【问题描述】:

我想从浏览器打开我的应用程序。

示例:我打开浏览器,输入:https://open.my.app 或 app://www.example.com,然后选择我的应用程序。

我阅读了有关 Deep Links 的信息,我很确定我正确地设置了我的项目,但当我尝试键入并运行时却没有任何反应:https://open.my.app, app://www.example.com

我的 AndroidManifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.somemobileapp">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:launchMode="singleTask"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Change these two in the future to a proper one -->
            <data android:scheme="https" android:host="www.example.com" />
            <data android:scheme="app" android:host="open.my.app" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

所以即使在这之后,它也不起作用。

【问题讨论】:

标签: android react-native deep-linking applinks


【解决方案1】:

我知道这听起来很奇怪,但首先保持数据标签对我有用

<intent-filter>
<!-- data on first -->
     <data android:scheme="http" android:host="abc.in"/>
        <action android:name="android.intent.action.MAIN" />
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.BROWSABLE"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-10
    • 2011-03-20
    • 1970-01-01
    • 2014-05-29
    • 2018-12-17
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    相关资源
    最近更新 更多