簡體   English   中英

Android深層鏈接

[英]Android Deep Links

在我的網頁中添加:

<meta property="al:android:url" content="myapp://dp/product/5" />
<meta property="al:android:app_name" content="myAPP" />
<meta property="al:android:package" content="xx.xxxx.xxx.v2" />

在我的AndroidManifest中,我添加了:

  <intent-filter>
            <data android:scheme="https" android:host="mywebsite.com" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>

當我在Google搜索中點擊我的鏈接之一時,它會打開我的應用程序,但我從getIntent()。getData()獲得的唯一信息是URL鏈接。 我如何從我的應用程序內部獲取信息(內容):

 <meta property="al:android:url" content="myapp://dp/product/5" /> 

謝謝

如果要打開mywebsite.com鏈接,那么您將從getData()獲取該URL。 要獲取myapp:// URI,您需要直接打開myapp://鏈接。 您需要為myapp://方案添加另一個帶有其自己的<data>標記的<intent>過濾器。 它可能看起來像這樣:

如果您只想在打開深層鏈接時傳遞鍵/值參數對,則可以考慮使用免費的深層鏈接平台,例如Branch.io (全面披露:我在Branch團隊中)。 這為您提供了每個鏈接的參數,這意味着具有更大的靈活性,並且無需像http鏈接那樣處理myapp://鏈接。 即使在首次打開鏈接時未安裝該應用程序,它也可以工作。

暫無
暫無

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

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