简体   繁体   中英

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

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>

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM