In my application, I want to handle links that use the following pattern:
scheme://host/folder1/folder2/folder3/folder4/article
I got it to work temporarily, by using the following:
<intent-filter>
<data android:scheme="http" />
<data android:host="www.laprensa.com.ni" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
However, as you may imagine that opens any link that starts with scheme://host
, and I want to make sure I only pick up on those that have the above stated pattern, where the page is 4 folders inside the host.
Another little problem is that the folder names are never the same, and therefore I cannot simply use android:path
. It's also worth noting that the android:pathPrefix
is not the same, as the first three folder are date related.
For instance, the urls are strucutred something like this:
scheme://host/year/month/day/articleType/article
I've been reading the docs and questions on how to use android:pathPattern
but I really don't understand what I'm supposed to type in.
Any ideas?
Thanks!
EDIT
Upon suggestion, I tried:
android:pathPattern="/.*/.*/.*/.*/.*"
Where each '.*' represented a folder but that seems to still pick up the other URLs that are not articles. For example, here are two different urls:
Url I want to handle:
http://www.laprensa.com.ni/2013/05/10/vida/145996-lionel-richie-defiende-a
Url I don't want to handle
http://www.laprensa.com.ni/2013/05/10/vida/
I guess the problem here is that they both have the same amount of levels, the only difference is that one actually has something after that last '/'
, any other ideas I can try? I did try adding one more '/.*'
but that stopped working completely and the app stopped handling any links period :(