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

Hello App Indexing

ymnder
June 23, 2017

Hello App Indexing

Otemachi.Firebase#2 2017/6/23

ymnder

June 23, 2017
Tweet

More Decks by ymnder

Other Decks in Programming

Transcript

  1. What’s App Indexing • Google ݕࡧͱ࿈ܞͯ͠ɺϢʔβʔͷϦϐʔτ཰Λ޲্ ͤ͞Δ • Chrome΍Google Search

    Appͷݕࡧ݁Ռ͔Β௚઀Ξϓ ϦʹભҠͰ͖Δ • ϢʔβʔʹΠϯετʔϧޙʹ࠶Ξϓϩʔν͢Δ͜ͱ͕Ͱ ͖Δ
  2. Which device does it work? • ChromeΛΠϯετʔϧ͍ͯ͠Δ୺຤ • API 14Ҏ্Ͱಈ͘͜ͱΛ֬ೝࡁΈ

    • Search AppΛΠϯετʔϧ͍ͯ͠Δ୺຤ • ஫ҙɿAPI 16Ҏ্Ͱͳ͍ͱΠϯετʔϧͰ͖ͳ͍ • Google Assistant͕࢖͑Δ୺຤ • API 23Ҏ্Ͱ࢖͑ΔΑ͏ʹͳͬͨ
  3. Hello App Indexing :) • App Indexing • WebαΠτʹΞϓϦ΁ͷdeeplinkΛઃஔ •

    αΠτΛ։͍ͨͱ͖ʹΞϓϦ͕։͘ • App Indexing API • ΦʔτίϯϓϦʔτ • Google Search Appͷݕࡧ݁ՌʹաڈӾཡͨ͠Ξϓ Ϧͷϖʔδ͕දࣔ͞ΕΔ • ΩʔϫʔυͰΞϓϦͷϖʔδΛҾֻ͚ͬΒΕΔ
  4. Hello App Indexing :) • App Indexing • WebαΠτʹΞϓϦ΁ͷdeeplinkΛઃஔ •

    αΠτΛ։͍ͨͱ͖ʹΞϓϦ͕։͘ • App Indexing API • ΦʔτίϯϓϦʔτ • Google Search Appͷݕࡧ݁ՌʹաڈӾཡͨ͠Ξϓ Ϧͷϖʔδ͕දࣔ͞ΕΔ • ΩʔϫʔυͰΞϓϦͷϖʔδΛҾֻ͚ͬΒΕΔ
  5. Hello App Indexing :) • App Indexing • WebαΠτʹΞϓϦ΁ͷdeeplinkΛઃஔ •

    αΠτΛ։͍ͨͱ͖ʹΞϓϦ͕։͘ • App Indexing API • ΦʔτίϯϓϦʔτ • Google Search Appͷݕࡧ݁ՌʹաڈӾཡͨ͠Ξϓ Ϧͷϖʔδ͕දࣔ͞ΕΔ • ΩʔϫʔυͰΞϓϦͷϖʔδΛҾֻ͚ͬΒΕΔ
  6. How to connect with your site: web side • HTTPSͷ৔߹

    & Android SDK Platform 23 or higher • Digital Assets Links • https://<yoursite>/.well-known/assetlinks.json
  7. How to connect with your site: web side • HTTPͷ৔߹

    • Search ConsoleͰWebͱΞϓϦΛඥ෇͚Δ • WebͱAppΛҧ͏ΞΧ΢ϯτͰ؅ཧͯͯ͠΋େৎ෉
  8. How to connect with your site: web side • αΠτʹmetaλάΛ௥Ճ͢Δ

    • custom URL͸ඇਪ঑͕ͩ࢖͑Δ package_id scheme host
  9. How to connect with your site: app side @Override protected

    void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recipe); onNewIntent(getIntent()); } protected void onNewIntent(Intent intent) { String action = intent.getAction(); String data = intent.getDataString(); if (Intent.ACTION_VIEW.equals(action) && data != null) { //write wonderful codes… } }
  10. How to connect with your site: app side @Override protected

    void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recipe); onNewIntent(getIntent()); } protected void onNewIntent(Intent intent) { String action = intent.getAction(); String data = intent.getDataString(); if (Intent.ACTION_VIEW.equals(action) && data != null) { //write wonderful codes… } }
  11. How to connect with your site: app side @Override protected

    void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recipe); onNewIntent(getIntent()); } protected void onNewIntent(Intent intent) { String action = intent.getAction(); String data = intent.getDataString(); if (Intent.ACTION_VIEW.equals(action) && data != null) { //write wonderful codes… } }
  12. How do I test app indexing • manifestͷهड़͕߹͍ͬͯΔ͔ • Android

    StudioɿAnalyze -> Inspect Code • intent͸ਖ਼͘͠௨Δ͔ • adb shell am start -a android.intent.action.VIEW -d "{URL}" {package name} • Webʹmetaλά࢓ࠐΜͩͷʹಈ͔ͳ͍ • Google search಺ͷfetch as googleͰ࠶Ϋϩʔϧ • ΋͔ͯ͠͠ɺඥ෇͍ͯͳ͍ϦϯΫΛ։͍ͯΔʁ
  13. App Indexing API is updated…….. • 10.0.0͔ΒAPI͕େ͖͘มߋ͞Εͨ • codelabs •

    ஫ҙ • ೔ຊޠͷget started ͸ߋ৽͞Εͯͳ͍ • https://firebase.google.com/docs/app-indexing/ android/migrate
  14. App Indexing API is updated……. • GoogleApiClientΛ࢖Θͳ͘ͳͬͨ • ΦʔτίϯϓϦʔτʹ࢖͏ϢʔβʔΞΫγϣϯͷϏϧυ Ϋϥε͕γϯϓϧʹͳͬͨ

    • ϢʔβʔΞΫγϣϯͷߋ৽ํ๏͕มΘͬͨ • ΠϯσοΫεʹΞΫγϣϯ͕௥Ճ͞Ε͍ͯΔ͜ͱΛ֬ ೝ͔ͯ͠ΒΞοϓσʔτΛߦ͏
  15. App Indexing API is updated…… // Before import com.google.android.gms.appindexing.Action; import

    com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; // After import com.google.firebase.appindexing.Action; import com.google.firebase.appindexing.FirebaseUserActions; import com.google.firebase.appindexing.Indexable; import com.google.firebase.appindexing.builders.Actions;
  16. App Indexing API is updated….. // Before import com.google.android.gms.appindexing.Action; import

    com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; // After import com.google.firebase.appindexing.Action; import com.google.firebase.appindexing.FirebaseUserActions; import com.google.firebase.appindexing.Indexable; import com.google.firebase.appindexing.builders.Actions;
  17. App Indexing API is updated…. //Before public Action getAction() {

    Thing object = new Thing.Builder() .setName(mText) .setUrl(mUrl) .build(); return new Action.Builder(Action.TYPE_VIEW) .setObject(object) .build(); } // After public Action getAction() { return Actions.newView(mText, mUrl); }
  18. App Indexing API is updated… //Before public Action getAction() {

    Thing object = new Thing.Builder() .setName(mText) .setUrl(mUrl) .build(); return new Action.Builder(Action.TYPE_VIEW) .setObject(object) .build(); } // After public Action getAction() { return Actions.newView(mText, mUrl); }
  19. App Indexing API is updated.. //Before @Override protected void onStart()

    { super.onStart(); mClient.connect(); AppIndex.AppIndexApi.start(mClient, getAction()); } @Override protected void onStop() { AppIndex.AppIndexApi.end(mClient, getAction()); mClient.disconnect(); super.onStop(); }
  20. App Indexing API is updated. // After @Override protected void

    onStart() { super.onStart(); FirebaseAppIndex.getInstance().update(getIndexable()); FirebaseUserActions.getInstance().start(getAction()); } @Override protected void onStop() { FirebaseUserActions.getInstance().end(getAction()); super.onStop(); }
  21. App Indexing: Cons • ΞϓϦΛΠϯετʔϧͯ͠ͳ͍ͱભҠ͠ͳ͍ • re-engageࢪࡦ • fallback͸ͳ͍ •

    Πϯετʔϧಋઢ͸૿͑Δ͚Ͳɾɾɾ • Կނ͔ΞϓϦ͕։͔ͳ͍৔߹͕͋Δ • ൓өʹϥά͕͋Δ
  22. References • First Click Free • https://support.google.com/news/publisher/answer/ 40543?hl=ja • https://productforums.google.com/forum/#!topic/

    webmaster-ja/TRvgIx3Sr2k;context- place=topicsearchin/webmaster-ja/category$3Aapp- indexing • BackButton • https://webmasters.googleblog.com/2014/04/app- indexing-updates.html