简体   繁体   English

使用深层链接打开android应用

[英]Opening the android app using a deep link

My requirement is, There is an advertisement in an email for a shoe, if I click on that ad, it should open my app directly and take me to corresponding page without asking any available option like web browser, etc. 我的要求是,电子邮件中有一条关于鞋子的广告,如果我点击该广告,它应直接打开我的应用,并带我到相应页面,而无需询问任何可用的选项,例如网络浏览器等。

I tried Deep linking fundamental, But I don't know how to create deep links, from where I can get custom scheme(eg. testlink://test). 我尝试了基本的深层链接,但是我不知道如何创建深层链接,从中可以获取自定义方案(例如testlink:// test)。 for eg. 例如 google play scheme is market://details/ 谷歌播放方案是市场:// details /

Thanks in advance 提前致谢

To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest. 为了使Google能够抓取您的应用程序内容并允许用户从搜索结果中进入您的应用程序,您必须在应用程序清单中添加针对相关活动的意图过滤器。

refer https://developer.android.com/training/app-indexing/deep-linking.html 请参阅https://developer.android.com/training/app-indexing/deep-linking.html

https://developers.google.com/app-indexing/android/app https://developers.google.com/app-indexing/android/app

There are actual several questions at play here: 1 - You need to know how to create a URI scheme(the testlink:// protocol you reference). 这里有一些实际的问题在起作用:1-您需要知道如何创建URI方案(您引用的testlink://协议)。 2 - You need to make your app do something when the end user clicks on the deep link. 2-当最终用户点击深层链接时,您需要让您的应用执行某些操作。

To begin at the beginning, you don't "get" the custom scheme from anywhere, you create a URI scheme as part of setting up your app. 首先,您无需从任何地方“获取”自定义方案,而是在创建应用程序时创建URI方案。 There is no real standardization as to what that scheme should be (despite some attempts). 关于该方案应该是什么没有真正的标准化(尽管有一些尝试)。

The question of how to do this have been answered elsewhere ( How to implement my very own URI scheme on Android and in the android docs). 如何做到这一点的问题已经在其他地方得到解答( 如何在Android和android文档中实现我自己的URI方案 )。

And I actually just published a blog post with some suggestions on how to optimize that URI scheme ( https://blog.branch.io/creating-uri-schemes-for-app-content-discovery ). 我实际上刚刚发布了一篇博客文章,其中包含有关如何优化URI方案的一些建议( https://blog.branch.io/creating-uri-schemes-for-app-content-discovery )。

The second question is easier. 第二个问题比较容易。 Once you have that scheme in place, a user who 一旦制定了该方案,

(a) clicks on a link that matches your scheme (b) has your app installed and (c) doesn't have some other app installed which uses the same scheme and which they've already set as the default for that scheme (a)单击与您的方案匹配的链接(b)安装了您的应用,并且(c)没有安装其他使用相同方案且已将其设置为该方案默认设置的其他应用

will be launched directly into your app to the exact location / experience that you defined when you were setting up your intent filters. 将直接启动到您的应用中,以设置您的意图过滤器时所定义的确切位置/体验。

Now if you want your deep links to work for users who don't already have your app installed you'll need to use a deferred/contextual deeplinking service. 现在,如果您希望深层链接对尚未安装应用程序的用户有效,则需要使用延迟/上下文深层链接服务。 Obviously I'm inclined towards Branch.io since I work for them, but I work for them because I think they have the best offering. 显然,因为我为他们工作,所以我倾向于Branch.io,但是我为他们工作是因为我认为他们提供了最好的产品。

Regarding your last requirement, that there be no browser pop in between, the browser pop is usually part of the flow because it allows a deep linking service to pass some information to their servers about the user on click so that if the user does not have the app they can be directed to the app store and if they do have the app it can be launched by invoking your URI scheme. 关于您的最后一个要求,即中间没有浏览器弹出窗口,浏览器弹出窗口通常是流程的一部分,因为它允许深度链接服务将一些有关单击用户的信息传递给他们的服务器,以便在用户没有点击时可以将他们定向到应用商店,如果他们确实拥有该应用,则可以通过调用您的URI方案将其启动。 If you want to do any sort of matching between click and install for users who do not already have the app or pass any info from the click to the app once it launches it been simply unavoidable until now. 如果您想为尚未拥有该应用程序的用户在点击和安装之间进行任何类型的匹配,或者要在启动后将任何信息从点击传递到应用程序,到目前为止,这是不可避免的。 Universal links on iOS (new in iOS9) change that. iOS上的通用链接 (iOS9中的新增功能)改变了这一点。 They can be invoked directly without needing to go through the browser and pass data directly into the app being launched, which is a pretty big deal. 可以直接调用它们,而无需通过浏览器并将数据直接传递到正在启动的应用程序中,这是一个很大的问题。 Google is expected to announce an equivalent for Android in the very near future. 预计Google将在不久的将来宣布与Android相当的产品。 The setup is a bit intense, but worth it for the improved user experience. 设置有些紧张,但是值得改善用户体验。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM