如何在需要在页面上设置标记的Android应用中执行深层链接?

时间:2018-09-21 12:56:37

标签: android webview deep-linking

我有一个Android应用程序。其中包含一个仅包含WebView的Actvity。

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.constraint.ConstraintLayout>

现在有点棘手了。 WebView是一个包含多个div的html页面。每个div都有不同的内容,例如Dog Care,Cat Care,Rabbit Care等。它不是服务器上的外部网页,它本地该应用程序的资产。

通过调用OnMyMenu('dog');等在网页上一次只显示一个div。(这不是关于javascript / android桥的问题,我知道该怎么做。)

问题1:我如何在程序的android部分中进行深层链接,以便当有人在Google搜索“狗护理”或与我认为与关键字相关的任何内容时对于我的“狗狗护理”页面很重要,Google搜索将首先链接到我的应用,其次链接到包含我的Activity的{​​{1}},最重要的是可以某种方式调用Webview OnMyMenu('dog');中是否显示了正确的webview

问题2:作为第二个问题,如何设置我认为在深度链接中重要的关键字?

0 个答案:

没有答案