1
我希望我的React Native应用程序能够从其他应用程序接收URL意图。因此,例如,当我使用QR代码扫描器扫描URL并想要打开它时,我安装的浏览器中也会出现我的React Native应用程序。React Native:未接收其他Android应用程序的意图
我跟着的Linking指示:
- 如图中Linking documentation我实现
componentDidMount()
。 在
android/app/src/main/AndroidManifest.xml
,我根据the Android docs编辑<intent filter>
部分,所以它现在看起来是这样的:<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="www.example.com" android:pathPrefix="/gizmos" /> </intent-filter>
这样做之后,我预计,扫描http://www.example.com/gizmos
我QR扫描后试图打开它,扫描仪会为我提供我的React Native应用程序。但是,它只显示我之前安装的浏览器。
我的期望错了吗?或者可以做些事情来做到这一点?