【发布时间】:2019-03-25 13:49:19
【问题描述】:
我构建了一个 API,它重定向到 playstore 中的相应应用链接。在互联网浏览器中使用 API 时,它不是打开应用程序,而是打开网页。
我正在使用以下代码:
AndroidManifest.xml
<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:host="scoutnex-deeplink.herokuapp.com" android:scheme="https" android:pathPrefix="/scoutnex"/>
</intent-filter>
App.js
componentDidMount(){
Linking.getInitialURL()
.then(url => this.handleOpenURL({ url }))
.catch(console.error);
Linking.addEventListener("url", this.handleOpenURL);
}
如果我使用类似下面的代码,互联网浏览器会提示请求打开一个使用 url peopleapp://people 的外部应用程序。
<data android:host="people" android:scheme="peopleapp"/>
【问题讨论】:
标签: android react-native react-native-android deep-linking