我目前正在尝试设置deep linking
到我的React Native
应用程序中。我正在创建一个共享功能,以便用户可以在我的应用程序中向他的朋友展示一个页面。当您单击 Netflix 或 Spotify 的链接时,我想要相同的行为 - 即使应用程序已关闭,它也会直接打开应用程序。
为了做到这一点,我创建了一个Nextjs
Web 应用程序来为我的链接提供一些漂亮的元标记。
另外,我已经配置了我的Navigator
using React Navigation v5
.
const config = {
screens: {
Feed: {
screens:{
LocalInside: "share/:localId"
}
},
Ranking: 'ranking'
},
};
const linking = {
prefixes: ['https://[myapp]-web.vercel.app', '[myapp]://'],
config,
};
...
<NavigationContainer linking={linking}>
Run Code Online (Sandbox Code Playgroud)
注意:两个链接的后缀相同,即“/share/:localID”
最后,我了解到为了测试deep link
我可以使用的,uri-scheme
所以我跑了
npx uri-scheme open [myapp]://share/[someLocalID] --android
Run Code Online (Sandbox Code Playgroud)
有效。但我无法让我的 vercel.app 链接工作。不在 Android 浏览器上,也不在使用uri-scheme
.
所以我想知道如何让我的 Nextjs 网站 URL 像 …