how to set host name and scheme for a custom header - url scheme

873 Views Asked by At

I have a simple page on the server side like below link :

<button onclick="location.href='http://www.example.com/com.example.example://?status=true'">click me</button>

now I would like when I click on click me button, my application opens.

but how should I set the data tag in manifest.xml ?


        <intent-filter >
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.VIEW"/>
            <data android:host="http://www.example.com" android:scheme="com.example.example"/>
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

updated :

        <intent-filter >
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.VIEW"/>
            <data android:path="/com.example.example" android:scheme="http" android:host="www.example.com" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

after click on click me,Nothing happens.


updated

        <intent-filter >
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.VIEW"/>
            <data android:path="/com.shadyab.shadyab" android:scheme="http" android:host="www.shadyab.com" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
1

There are 1 best solutions below

9
On

scheme is http and host is www.example.com, I don't know why you. after the host comes the path . You can use one between

  android:path="string"
  android:pathPattern="string"
  android:pathPrefix="string"