Okay, so I get that if I have a website and an app that roughly displays the same content, app indexing can be used to open links to the website in the app instead (if the user has it installed).
To do this, one specifies deep links in the web pages that specify a URI to the app and the content. This also lets Googlebot know about the webpage-to-app-intent connection so it can display stuff in search results, etc (i.e. indexing
). One can also specify intent-filters that handle website URL's, so links to your website can automatically open the app and display the content there, without even opening the webpage in a browser.
The part that I'm having problem understanding is that in an android app you add code (which can be automatically generated by Android Studio) that "goes the other way".
For example
@Override
public void onStart() {
super.onStart();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
Action viewAction = Action.newAction(
Action.TYPE_VIEW, // TODO: choose an action type.
"Main Page", // TODO: Define a title for the content shown.
// TODO: If you have web page content that matches this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
Uri.parse("http://host/path"),
// TODO: Make sure this auto-generated app URL is correct.
Uri.parse("android-app://com.magnuswikhog.adrlibrary/http/host/path")
);
AppIndex.AppIndexApi.start(client, viewAction);
}
So what is the purpose of this code? This seems to go the other way compared to the website-to-app-intent, and I don't really understand why you'd need to do that? If I only implement deep-linking and handling URL-intents, users will be able to open the app instead of the webpage, no need for AppIndex
.
Is it mostly a way for Google to gather statistics for how users of the app are using screens that have a corresponding webpage? If so, what impact does this have? Does it affect app ranking (and/or website ranking?) Is it essential to implement this if I'm implementing all the other parts of app indexing?