2016-09-14 22 views
9

Tôi muốn ứng dụng của mình mở trên http://www.example.comhttps://www.example.com.Sơ đồ liên kết sâu của Android: khớp với cả http và https

này hoạt động:

  <data 
       android:host="www.example.com" 
       android:path="/" 
       android:scheme="http"/> 

      <data 
       android:host="www.example.com" 
       android:path="/" 
       android:scheme="https"/> 

Có thể bắt cả với một mục nhập? Tôi đã thử:

  <data 
       android:host="www.example.com" 
       android:path="/" 
       android:scheme="http*"/> 

nhưng điều này chỉ bắt liên kết http chứ không phải liên kết https.

Vì vậy, tôi biết cách tôi có thể xử lý các biến thể bot, nhưng muốn sử dụng viết súc tích nhất có thể.

+0

Không thể tôi nghĩ rằng –

+0

Tôi cũng nghĩ rằng, đó là không thể. –

+0

Tôi không nghĩ rằng trường này hỗ trợ regex, nhưng bạn có thể thử 'android: scheme =" https? "' –

Trả lời

2

Điều này dường như làm các trick cho tôi:

<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:scheme="http" /> 
    <data android:scheme="https" /> 
    <data android:host="www.mywebsite.com" /> 
    <data android:pathPrefix="/mypage.php" /> 
</intent-filter> 
2

Bạn có thể sử dụng riêng biệt <intent-filter> cho cả

<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.example.com" 
      android:path="/" 
      android:scheme="http"/>  
</intent-filter> 
<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.example.com" 
      android:path="/" 
      android:scheme="https"/>  
</intent-filter> 
+1

Đó là những gì tôi muốn tránh, tôi muốn có ngắn nhất (về nhân vật trong tệp kê khai của tôi) khả năng. – FWeigl

+0

đôi khi bạn không thể tránh, ngoại trừ nếu bạn sẽ thay đổi mã hóa hệ điều hành :) –

+0

Đã sợ như vậy;) Cảm ơn anyway. – FWeigl

Các vấn đề liên quan