【问题标题】:Deep Linking Android first opens the launcher activity (not the deeply linked activity )Deep Linking Android 首先打开启动器活动(不是深度链接活动)
【发布时间】:2015-06-12 13:37:19
【问题描述】:

Deep Linking Android 首先打开启动器活动(不是深度链接活动),然后是 Manifest 文件中声明的深度链接活动。我已按照 here 中提到的所有步骤进行操作。

即。清单包含

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_title_viewgizmos">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
        <data android:scheme="http"
              android:host="www.example.com"
              android:pathPrefix="/gizmos" />
        <!-- note that the leading "/" is required for pathPrefix-->
        <!-- Accepts URIs that begin with "example://gizmos”
        <data android:scheme="example"
              android:host="gizmos" />
        -->
    </intent-filter>
</activity>

并且深度链接的活动包含

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
}

以及其他一些特定于活动的代码。

【问题讨论】:

    标签: hyperlink android-deep-link


    【解决方案1】:

    我遇到了同样的问题,就我而言,这只是一个复制和粘贴问题。确保您的深层链接意图过滤器仅存在于清单中正确的活动下。如果您在 2 个不同的活动下有 2 个相同的过滤器,它将打开第一个(逻辑上您的主要活动将是您的第一个)

    【讨论】:

      【解决方案2】:

      只需从意图过滤器中删除android:label="@string/filter_title_viewgizmos"。您的代码将开始工作。

      谢谢。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-12-13
        • 1970-01-01
        • 2021-06-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多