2016-10-15 61 views
0

我已經添加了深度鏈接到我這樣的所有活動。如何防止從android中的移動網站深層鏈接?

android-app://com.example.app/https/www.example.com/stores

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

這時候,我的應用程序中使用URI這樣調用工作正常但是當我訪問移動網站到這個頁面時,它給了我多個選項來打開應用程序或瀏覽器中的頁面:https://www.example.com/stores。我有一些只在用戶登錄時才顯示的頁面,但如果用戶從移動站點登錄,它將重定向到應用程序,並且它會中斷。我不想使用自定義架構。

回答

0

你需要檢查用戶的登錄狀態在活動的切入點,並顯示登錄活動(或對話)給他們,如果他們沒有登錄。

您必須在不同的處理這個自己活動。這通過深度鏈接可用。只需在每次打開這些活動時檢查登錄狀態,並在需要的情況下直接登錄活動或對話。

如果你不想你的瀏覽器添加您的應用程序的URI意圖建議列表,只是刪除「可瀏覽」象下面這樣:

<intent-filter> 
     <action android:name="android.intent.action.VIEW" /> 
     <category android:name="android.intent.category.DEFAULT"/> 
     <data 
      android:host="www.example.com" 
      android:path="/stores" 
      android:scheme="https" /> 
     </intent-filter> 
+0

是啊,我在做活動,現在這個檢查登錄狀態,但是否有任何選項可以阻止移動網站提供多個選項 – Yogi

+0

要完全阻止瀏覽器打開您的應用程序? –

+0

是的,但我想在應用程序深度鏈接使用應用程序uris – Yogi