1

我已經在我的應用程序中實現了深度鏈接。果然,當我點擊瀏覽器中的鏈接時,它會打開應用程序。但是,當我做深層鏈接啓動應用程序,但說uri爲空

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

兩個actiondata爲空。什麼會導致這樣的事情?我想象它打開我的應用程序意味着它有一個uri。

這裏是我的意圖過濾

<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="www.mywebsite.com" 
       android:scheme="http"/> 
      <data 
       android:host="www.mywebsite.com" 
       android:scheme="https"/> 
      <data 
       android:host="mywebsite.com" 
       android:scheme="http"/> 
      <data 
       android:host="mywebsite.com" 
       android:scheme="https"/> 
      <data 
       android:host="/*" 
       android:scheme="mywebsite"/> 
     </intent-filter> 
+0

您確定您正在檢查右側「活動」的「意圖」嗎? (例如,當您在下面的活動中檢查意圖時,您的'intent-filter'在啓動Activity上設置) –

+0

對不起,遲了回覆@KenVanHoeylandt。你釘了它。我正在使用Splash活動並忘記了這一點。所以謝謝你指出可能看得見的東西。 –

+0

不客氣!我會將它作爲答案發布,以便您可以批准它。 –

回答

3

確保你從右邊Activity檢查Intent

例如您的意圖過濾器在發佈時設置爲Activity而您正在檢查以下意向Activity

+0

如何設置一個動態鏈接來打開一個特定的活動,在我的情況下它正在打開啓動器活動。 –

相關問題