簡體   English   中英

Android深層鏈接未重定向到Play商店

[英]Android deep linking not redirecting to play store

我已自定義深層鏈接,對於擁有該應用程序的用戶來說,它工作正常。 但是對於沒有該應用程序的用戶,它不會將其重定向到Playstore。

<intent-filter>

            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:host="abc.in"
                android:pathPrefix="/abc"
                android:scheme="http" />
            <action android:name="android.intent.action.VIEW" />
</intent-filter>

MY代碼生成深層鏈接

public void Share() {
    firebaseAnalyticsUtil.fireEvent("shared_link");
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    sharingIntent.putExtra(Intent.EXTRA_SUBJECT,"Hey!");
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Share Text - "+"http://abc.in/abc/"+ID);
    startActivity(Intent.createChooser(sharingIntent,"Share using"));
}

如果用戶沒有應用,請協助我將用戶重定向到Playstore

您正在使用App Links ,這意味着它們是常規的http://鏈接。 當用戶單擊http://abc.in/abc ,將發生以下兩種情況之一:

  1. 如果安裝了您的應用程序,則用戶可以選擇打開它(要直接將其發送到那里而不顯示選擇器,您需要請求App Links Verification )。
  2. 如果未全部安裝,則該用戶將被帶到其Web瀏覽器中的http://abc.in/abc

在您要處理的情況2中,此方法很簡單:使用位於http://abc.in/abc的頁面將訪客重定向到Play商店。 這可以通過Javascript或HTTP(最常見的是307重定向)來完成。

但是,請注意,僅此一項不足以提供完整的深度鏈接解決方案。 您還需要支持...

  1. 針對應用鏈接不起作用的情況的自定義URI方案
  2. 適用於Chrome的Chrome Intent
  3. 延遲深層鏈接 ,以確保您的用戶在下載后仍被發送到您應用中的正確位置。

我建議研究托管的深層鏈接服務,例如Branch.io (完整披露:我在Branch團隊中)或Firebase動態鏈接。 它們將使您的生活更加輕松。

為了使其對沒有您的應用的用戶有效,您可以使用Firebase動態鏈接。 您還可以使用Firebase動態鏈接跟蹤參數和分析。 它是免費使用。 這是其教程的鏈接。 它很容易遵循教程。

https://firebase.google.com/docs/dynamic-links/

如果您在實現動態鏈接時遇到任何麻煩,請隨時與我聯系。

要在PlayStore上進行重定向,請在下面的行中使用;

  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("use your playstore app Link")));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM