Reputation: 358
So, I was trying to implement app indexing to allow "Open in App" feature from google search (in Chrome app).
I've implemented the following sections from google docs https://developers.google.com/app-indexing/:
Add Deep Linking to your App
<activity
android:name=".DeepLinkActivity">
<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:scheme="http"
android:host="dl.mysite.com"
android:pathPattern="/" /> <!-- Home page -->
</intent-filter>
</activity>
Connect your App
I've verified and approved the website from Webmaster and Play console.
Provide Deep Links
<link rel="alternate" href="android-app://com.MyApp.MyApp/http/dl.mysite.com/" />
I've tried testing my link "android-app://com.MyApp.MyApp/http/dl.mysite.com/" in https://developers.google.com/app-indexing/webmasters/test and the link opens my app home page. However, the listing corresponding to my site in google search results (in Chrome app) has no "Open in App" function.
I'd like to have this "Open in App" function. I'd appreciate any help.
Upvotes: 4
Views: 896
Reputation: 93
Try this solution
<activity ... android:launchMode="singleTask">
[...]
<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="@string/domain"
android:scheme="https"
android:pathPattern=".*" />
<data
android:host="@string/domain"
android:scheme="http"
android:pathPattern=".*" />
</intent-filter>
Different behaviors in Open in App from browsers and other applications to my webView app
Upvotes: 2
Reputation: 13113
android-app://...
is a normal deep link and is different from App Indexing.
App Indexing include http://...
and https://...
urls only!
If you want App Indexing to work,
What you need is a /.well-known/assetlinks.json
as on website.
It's called Google/ Firebase App Indexing - https://firebase.google.com/docs/app-indexing
There is an App Links Assistant built into Android Studio that will help you generate the assetlinks.json
file and test URLs among other useful things.
Upvotes: 1
Reputation: 358
Answer to a similar question addresses this problem.
App Indexing Android - "<link>" in "<head>" doesn't work
To quote, "It'll work only from google search results page. If your website is properly indexed and appears in google search results, check if exists in the website's page source in google's cached content: http://webcache.googleusercontent.com/search?q=cache:yourwebsite.com.
Also, you might need to move your apk to PRODUCTION if it's in BETA TESTING in Google Play Developer Console."
Upvotes: 0