Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to App Indexing API

Shohei Kawano
November 24, 2015

Introduction to App Indexing API

Google has allowed both Android / iOS developers to publish deep links through a part of the Google Play Services API, which is App Indexing API.

This talk is a super brief introduction to App Indexing API for those who do not know about it, have heard about it but not really sure what it is or how to implement it.

* https://developers.google.com/app-indexing/android/publish?hl=en
* http://search-codelabs.appspot.com/codelabs/app-indexing#1
* http://searchengineland.com/google-adds-additional-ranking-boost-for-using-app-indexing-api-232018

Shohei Kawano

November 24, 2015
Tweet

More Decks by Shohei Kawano

Other Decks in Programming

Transcript

  1. • Part of Google Play Services • Publishing deep links

    from App • Easy to implement App Indexing API
  2. • Part of Google Play Services • Publishing deep links

    from App • Easy to implement App Indexing API
  3. AndroidManifest / build.grade <!—- AndroidManifest.xml —-> <application ... <meta-data android:name="com.google.android.gms.version"

    android:value="@integer/google_play_services_version" /> ... </application> // build.gradle compile ‘com.google.android.gms:play-services-appindexing:8.3.0' https://developers.google.com/app-indexing/android/publish?hl=en
  4. Activity#onCreate() private GoogleApiClient mClient; @Override protected void onCreate(Bundle savedInstanceState) {

    ... mClient = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); ... } https://developers.google.com/app-indexing/android/publish?hl=en
  5. Activity#onStart() @Override public void onStart() { super.onStart(); mClient.connect(); String title

    = "App Indexing API Title"; Action viewAction = Action.newAction(Action.TYPE_VIEW, title, WEB_URL, APP_URI); AppIndex.AppIndexApi.start(mClient, viewAction); ... } https://developers.google.com/app-indexing/android/publish?hl=en
  6. Activity#onStop() @Override public void onStop() { ... String title =

    "App Indexing API Title"; Action viewAction = Action.newAction(Action.TYPE_VIEW, title, WEB_URL, APP_URI); AppIndex.AppIndexApi.end(mClient, viewAction); mClient.disconnect(); ... super.onStop(); } https://developers.google.com/app-indexing/android/publish?hl=en
  7. Fragments “Typically, you'll set this up within the onStart() and

    onStop() methods of your app, but it's not strictly necessary, such as when sending fragments or other scrolling-type UIs.” https://developers.google.com/app-indexing/android/publish?hl=en
  8. Fragments “Typically, you'll set this up within the onStart() and

    onStop() methods of your app, but it's not strictly necessary, such as when sending fragments or other scrolling-type UIs.” https://developers.google.com/app-indexing/android/publish?hl=en
  9. Tips • Make sure you pass NON-NULL values • Make

    sure you call mClient.connect();
  10. Activity#onStart() @Override public void onStart() { super.onStart(); mClient.connect(); String title

    = "App Indexing API Title"; Action viewAction = Action.newAction(Action.TYPE_VIEW, title, WEB_URL, APP_URI); AppIndex.AppIndexApi.start(mClient, viewAction); ... } https://developers.google.com/app-indexing/android/publish?hl=en
  11. Tips • Make sure you pass NON-NULL values • Make

    sure you call mClient.connect();
  12. Tips • Make sure you pass NON-NULL values • Make

    sure you call mClient.connect(); • Make sure you implement it! (if applicable)