App indexingのススメ(補足版)

Post on 16-Jul-2015

2238 Views

Category:

Engineering

2 Downloads

Preview:

Click to see full reader

Transcript

App Indexing のススメ (補足版)

consomme

自己紹介• 山崎 正

• @consomme72

• ピクシブ株式会社 Androidアプリ開発

アドベントカレンダー進行中http://qiita.com/advent-calendar/2014/pixiv

書きましたhttp://inside.pixiv.net/entry/2014/12/15/152113

図を作るのが面倒だったので 省略した部分の補足

App Indexing とは• Googleの検索結果から直接アプリを開く

• アプリケーション選択ダイアログを経由しない

×

実装方法は blogの記事と

Googleのドキュメントを参照

First Click Free• 最初のクリックは登録、購読不要の原則

• コンテンツの表示を遮ってはいけない

戻るボタンの動作• App Indexingでアプリを開いた後に戻るボタンを押した時はGoogle検索結果に遷移させる

○×

対応しないとエラー判定されます

App Indexing API

• アプリからディープリンクをGoogleに通知

• オートコンプリートからアプリを起動できる

public class SearchActivity extends Activity {

private GoogleApiClient mGoogleApiClient;

private static final Uri APP_URI = Uri.parse("android-app://jp.pxv.android/pixiv/illusts/tag/C87");

@Override public void onCreate(Bundle savedInstanceState) { ... mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(AppIndex.APP_INDEX_API).build(); ... }

@Override protected void onStart() { super.onStart();

mGoogleApiClient.connect();

String title = "App Indexing API Title"; Uri webUri = Uri.parse("http://www.pixiv.net/search.php?s_mode=s_tag&word=C87"); Uri touchUri = Uri.parse("http://touch.pixiv.net/search.php?s_mode=s_tag_full&word=C87");

AppIndex.AppIndexApi.view(mGoogleApiClient, this, APP_URI, title, webUri, null); AppIndex.AppIndexApi.view(mGoogleApiClient, this, APP_URI, title, touchUri, null); }

@Override protected void onStop() { super.onStop();

AppIndex.AppIndexApi.viewEnd(mGoogleApiClient, this, APP_URI); mGoogleApiClient.disconnect(); } }

https://developer.android.com/reference/com/google/android/gms/appindexing/AppIndexApi.html

WebURLをnullにすると どうなるの?

不明(特に説明なし) たぶんオートコンプリートは効くんじゃないかなぁ そのデータが共有されるのかどうかも不明

App Indexing API 注意点• コンテンツがない場合はAPIをコールしない

• 無駄に複数回APIをコールしない

• オートコンプリートは設定が必要

端末内検索を有効化

デフォルトで有効化する方法は今のところない

いろいろと今後に期待

エンジニア募集中http://recruit.pixiv.net/

以上

top related