code4jhon
code4jhon

Reputation: 6044

Is host a required configuration for deep linking in Android?

My question is the exact of the title:

Is host a required configuration for deep linking in Android ?

I have deep linked to Google Play to an uri like this :

"market://details?id=com.facebook.katana" their AndroidManifest had:

                    <data
                    android:scheme="market"
                    android:host="details"
                    android:path=""/>

But now I am required to deep link to some other app that doesn't have any host config:

Is this even posible?

I went to the docs(https://developer.android.com/training/app-indexing/deep-linking.html#handling-intents) and I see they are also using host config:

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_title_viewgizmos">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "example://gizmos” -->
        <data android:scheme="example"
              android:host="gizmos" />
        <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
        <data android:scheme="http"
              android:host="www.example.com"
              android:pathPrefix="gizmos" />
    </intent-filter>
</activity>

BUT IT ALSO SAYS:

"At minimum, the tag must include the android:scheme attribute."

So I am wondering is the host config mandatory for deep linking ?

Upvotes: 5

Views: 11504

Answers (2)

bitsabhi
bitsabhi

Reputation: 778

Host is not a mandatory parameter, but to resolve to a particular host url, you should provide it. Also the scheme could be anything, but http scheme is recommended by google, so that both your app and the browser app can listen the deeplinked url

Upvotes: 3

code4jhon
code4jhon

Reputation: 6044

Short answer: NO

Any application can still provide deep link support without specifying a host, although is way more clear specifying it.

Upvotes: 6

Related Questions