Ayhan Dorman
Ayhan Dorman

Reputation: 102

Android http URL scheme is not working when I try to launch my application from a link on my website

I'm trying to achieve to have my application launched (or fire an open-in dialog) when a link pointing to http://example.com/123 on my website is clicked. In my AndroidManifest.xml I added the following activity to register my app for 'http' links with host 'example.com'. But it simply visits http://example.com/123 link and nothing happens other than that when I touch on the link.

<activity xmlns:android="http://schemas.android.com/apk/res/android"
          android:name=".TestActivity"
          android:label="myapplication">
<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="example.com" android:scheme="http" />
</intent-filter>
</activity> 

Also tried with

android:pathPattern = ".*"

or

android:pathPattern = "*"

but none of them work. I appreciate for any suggestions from now.

Upvotes: 0

Views: 185

Answers (1)

Simas
Simas

Reputation: 44118

Try using pathPrefix instead of pathPattern.

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

Upvotes: 1

Related Questions