4

I want handle this URL but my code is not work true.

http://melkplus.com/#!/property/details/765


Actually when I click on this URL, my phone does not suggest me my application and it just open by browser.
I think application has problem with #! in URL.

<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="melkplus.com"
    android:scheme="http"
    android:pathPrefix="/#!/property/details/" />
</intent-filter>

1 Answers1

2

Everything starting with the # is not part of the path of the URL, but rather is the fragment. You cannot filter on fragments.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • So what should I do? – Ruhallah Ahmadian Dec 09 '17 at 15:17
  • @RuhallahAhmadian: Replace `android:pathPrefix="/#!/property/details/"` with `android:pathPrefix="/"`. – CommonsWare Dec 09 '17 at 15:34
  • but if I have another link, I can not open it. – Ruhallah Ahmadian Dec 09 '17 at 15:42
  • @RuhallahAhmadian: I do not know what "another link" is. – CommonsWare Dec 09 '17 at 15:42
  • @RuhallahAhmadian: That also matches `android:pathPrefix="/"`, and so your activity will handle both URLs. If you are saying that you want a *separate* activity to handle those two, you should be able to replace `android:pathPrefix="/#!/property/details/"` with `android:path="/"`, so the activity in your question only matches on `/`. Other activities could then match on other things (e.g., a prefix of `/agency`). – CommonsWare Dec 09 '17 at 17:43