如何将url方案用于未安装在设备中的应用程序

问题描述:

我在商店中有一个应用程序,它允许在第一个视图中显示项目列表,在第二个视图中显示项目的详细信息。

I have an application in store, which allow to display a list of items in a first view, details of an item in the second view.

我使用url scheme从外部源访问项目的详细信息(Facebook for example)

I use the url schemes to access to the details of an item from an external source (Facebook for exemple)

我的问题:如果设备中没有安装应用程序,是否有任何允许下载应用程序并在正确的项目中打开它的方式(使用网址方案)

My question: if the application was not installed in the device, is there any way that allow to download the application and open it at the right item (using url scheme)

提前感谢

您所描述的内容称为延迟深层链接深层链接是指使用链接直接打开你的应用程序到一个特定的内容,延期意味着即使没有安装该应用程序它也能正常工作。

What you're describing is called Deferred Deep Linking (Deep Linking refers to using a link to open your app directly to a specific piece of content, and Deferred means that it works even if the app isn't installed first).

不幸的是,无论是iOS还是Android,都没有本地方法可以实现这一点。 URL方案不起作用,因为如果未安装应用程序,总是失败并显示错误。 iOS 9+中Apple更新的通用链接如果没有安装应用程序,他们至少不会触发错误,但您仍然需要处理将用户从您的网站重定向到App Store的问题。使用Universal Links安装后,您无法将上下文传递到应用程序,因此您无法将用户发送到正确的项目,并且实际上不支持它们在很多地方

Unfortunately there's no native way to accomplish this on either iOS or Android. URL schemes don't work, because they always fail with an error if the app isn't installed. Apple's newer Universal Links in iOS 9+ get closer in that they at least don't trigger an error if the app isn't installed, but you'd still have to handle redirecting the user from your website to the App Store. You can't pass context through to the app after install with Universal Links, so you wouldn't be able to send the user to the correct item, and they actually aren't supported in a lot of places.

要使其工作,您需要一个远程服务器来关闭循环。您可以自己构建,但是你真的不应该出于很多原因,尤其是你有更重要的事情要做。像 Branch.io 这样的免费服务(完全披露:他们与我们合作非常棒)或Firebase动态链接可以为你处理所有这些。

To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do. A free service like Branch.io (full disclosure: they're so awesome I work with them) or Firebase Dynamic Links can handle all of this for you.