Reputation: 4417
I am trying to build an application where if I click the link my app(if installed) will open.But it's not working,don't know why.It's always redirecting to google.com
My manifest file
<activity android:name=".DeeplinkingActivity"
android:label="@string/app_name"
android:exported="true"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.NoActionBar">
<intent-filter android:label="@string/app_name">
<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 "http://example.com/soham" -->
<data android:scheme="http"
android:host="example.com"
android:pathPrefix="/soham" />
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/soham" />
</intent-filter>
</activity>
My test.html
<a href="intent://scan/#Intent;scheme=http;package=soham.com.deeplinking;S.browser_fallback_url=http%3A%2F%2Fgoogle.com;end"></a>
I think the problem is in the html file.Any help?
Upvotes: 0
Views: 153
Reputation: 32780
Your link is incorrect, you are using the host of the Android Intents with Chrome example. You need to use the host
and pathPrefix
configured in the AndroidManifest.xml
.
Your host
is example.com
and your pathPrefix
is /soham
, the link will become:
<a href="intent://example.com/soham#Intent;scheme=http;package=soham.com.deeplinking;S.browser_fallback_url=http%3A%2F%2Fgoogle.com;end">Deeplink</a>
Upvotes: 1
Reputation: 141
Try this: This is working for my app:
NOTE: write below code within your launcher activity tag
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="@string/app_name" >
<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://WRITE YOUR HOST NAME” -->
<data
android:host="index.html"
android:scheme="WRITE YOUR HOST NAME" />
</intent-filter>
<intent-filter android:label="@string/app_name" >
<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 "http://example.com/WRITE YOUR HOST NAME” -->
<data
android:host="WRITE YOUR HOST NAME.com"
android:pathPrefix="/index.html"
android:scheme="http" />
</intent-filter>
<intent-filter android:label="@string/app_name" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="WRITE YOUR HOST NAME" />
</intent-filter>
Upvotes: 0