2017-01-26 20 views
14

Người dùng của chúng tôi thỉnh thoảng nhận được email, ví dụ: thay đổi mật khẩu của họ. Khi họ nhấp vào liên kết, tôi muốn họ được gửi đến trang web của chúng tôi nhưng ứng dụng Android của chúng tôi đã được mở.Ứng dụng Android được mở từ các liên kết được gửi trong email

Liên kết ví dụ: là https://www.ourdomain.com/change-password/{random-string}.

Chúng tôi có liên kết sâu được kích hoạt trong ứng dụng của chúng tôi, nhưng chúng được cấu hình theo cách sau:

  <intent-filter android:label="..."> 
      <action android:name="android.intent.action.VIEW" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 

      <data 
       android:host="customhost" 
       android:pathPrefix="/" 
       android:scheme="https" /> 

      <data 
       android:host="www.ourdomain.com" 
       android:pathPrefix="/somethingelse" 
       android:scheme="https" /> 

      <data 
       android:host="www.ourdomain.com" 
       android:pathPrefix="/againsomethingelse" 
       android:scheme="https" /> 

      <data 
       android:host="someothercustomhost" 
       android:scheme="https" /> 

      <data 
       android:host="andagainacustomhost" 
       android:scheme="https" /> 
     </intent-filter> 

Vì vậy, phần change-password không phù hợp trong bất kỳ cấu hình đó, những gì có thể là lý do ứng dụng của chúng tôi được mở ra tuy nhiên?

EDIT

nó có vẻ như thể vấn đề là data -tag đầu tiên; nếu tôi nhận xét điều đó, nó hoạt động như mong đợi (ví dụ: https://www.ourdomain.com/change-password/1234 không được ứng dụng xử lý). Tôi không biết tại sao như customhost là một từ hoàn toàn khác nhau từ www.ourdomain.com ...

+0

Có vẻ như bạn đã thay đổi các liên kết trước khi đăng. Mà làm cho nó một chút bối rối. Nhưng điều này có vẻ đúng. Liên kết này không nên được mở bởi ứng dụng. Bạn có thể kiểm tra lại câu hỏi của mình không. ? Bạn có đăng các liên kết chính xác không? –

+0

có; 'www.ourdomain.com' là một url tiếng Đức,' customhost'-stuff là một thứ hoàn toàn khác với url, 'change-password'-thing là 1: 1 ngay. – swalkner

+0

có thể có các lý do/cấu hình khác khiến ứng dụng nghe miền đó không? – swalkner

Trả lời

2

Bạn có thể thử để tách nó thành <intent-filter> thành phần khác nhau, bởi vì với một <intent-filter> ứng dụng có thể bị lẫn lộn, ngay cả khi nó được viết một cách chính xác.

<intent-filter android:label="..."> 
    <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.ourdomain.com" 
     android:pathPrefix="/somethingelse" 
     android:scheme="https" /> 

    <data android:host="www.ourdomain.com" 
     android:pathPrefix="/againsomethingelse" 
     android:scheme="https" /> 
</intent-filter> 

<intent-filter android:label="..."> 
    <action android:name="android.intent.action.VIEW" /> 

    <category android:name="android.intent.category.DEFAULT" /> 
    <category android:name="android.intent.category.BROWSABLE" /> 

    <data android:host="customhost" 
     android:pathPrefix="/" 
     android:scheme="https" /> 
</intent-filter> 

<intent-filter android:label="..."> 
    <action android:name="android.intent.action.VIEW" /> 

    <category android:name="android.intent.category.DEFAULT" /> 
    <category android:name="android.intent.category.BROWSABLE" /> 

    <data android:host="someothercustomhost" 
     android:scheme="https" /> 
</intent-filter> 

<intent-filter android:label="..."> 
    <action android:name="android.intent.action.VIEW" /> 

    <category android:name="android.intent.category.DEFAULT" /> 
    <category android:name="android.intent.category.BROWSABLE" /> 

    <data android:host="andagainacustomhost" 
     android:scheme="https" /> 
</intent-filter> 
Các vấn đề liên quan