App shortcuts
-
Upload
namito-satoyama -
Category
Technology
-
view
97 -
download
0
Transcript of App shortcuts
App ShortcutsShibuya.apk #12Namito Satoyama
⾥⼭ 南⼈ [Namito Satoyama]メディアカンパニー 検索事業本部Engineer / Yahoo! ブラウザー Product Manager
経歴
SIer (2001〜)IT Consulting(2006〜)CyberAgent, Inc(2010〜)DeNA Co., Ltd.(2013〜)Yahoo Japan Corp. (2014/09〜)
活動
Shibuya.apk運営共著:「⿊帯エンジニアが教えるプロの技術
Android開発の教科書」(SB Creative)
Techblog執筆など
Photo by アフロ
What is theApp Shortcuts ?
App Shortcuts
□ API level 25+
□ 対応したランチャーアプリが必要
□ 最⼤5個設置できるが推奨は4個まで
https://developer.android.com/guide/topics/ui/shortcuts.html
ランチャーアイコン⻑押しでクイックにアプリのタスクにアクセスできる
App Shortcuts Design Guideline
□ circular
□ LIVE AREA = 44dp x 44dp
□ TOTAL AREA = 48dp x 48dp (LIVE AREA + padding 2dp)
https://commondatastorage.googleapis.com/androiddevelopers/shareables/design/app-shortcuts-design-guidelines.pdf
□ Material Grey 100
Pinned Shortcuts
□ 設置数無制限
□ ピン留めしたショートカットはアプリから消せない
App Shortcutsからランチャーへショートカットを「ピン留め(Pinned)」できる
□ アプリから無効化はできる
Static / Dynamic Shortcuts
Static Dynamic
削除 ✕ ◯
更新 △(要アプリ更新) ◯
⽤途例 メッセージ送信 /アラームの設定 …
特定の⼈への電話/特定の場所へのナビゲーション…
実装時にShortcutがStaticかDynamicかを選ぶ□ ⼀般的なアクション→Static Shortcuts□ 特定の状況に特化→Dynamic Shortcuts
Implement
【static】AndroidManifest.xml<?xml version=“1.0” encoding=“utf-8”?><manifest xmlns:android=“http://schemas.android.com/apk/res/android”
package=“shortcut.sample.yahoo.co.jp.shortcutsample”><application
android:allowBackup=“true” android:icon=“@mipmap/ic_launcher”android:label=“@string/app_name” android:supportsRtl=“true”android:theme=“@style/AppTheme”><activity android:name=“.MainActivity”>
<intent-filter><action android:name=“android.intent.action.MAIN” /> <!-- 必須 --><category android:name="android.intent.category.LAUNCHER" /> <!-- 必須 -->
</intent-filter><meta-data android:name="android.app.shortcuts"
android:resource="@xml/app_shortcuts" /></activity><activity android:name=".SubActivityForStatic"/><activity android:name=".SubActivityForDynamic"/>
</application></manifest>
<?xml version="1.0" encoding="utf-8"?><shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcutandroid:enabled="true"android:icon="@drawable/ic_appshortcuts_static_sample_with_circle"android:shortcutId="shortcut_id_sample"android:shortcutShortLabel="@string/shortcut_label_static"><!-- 遷移先を指定したintent --><intent
android:action=”android.intent.action.VIEW"android:targetClass="jp.co.mysample.shortcutsample.SubActivityForStatic"android:targetPackage=”jp.co.mysample.shortcutsample">
</intent><categories android:name="android.shortcut.conversation" />
</shortcut></shortcuts>
【static】res/xml/app_shortcuts.xml
shortcutDisabledMessage
【static】parameter
enabled=“false”
public void addShortcut(final Context context) {// SDK_INT < 25なら抜けるif (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
return;}
// SDK_INT >= 25 ならAppShortcutを設定addShortcutIfTargetVersion(context);
}
@TargetApi(Build.VERSION_CODES.N_MR1)private void addShortcutIfTargetVersion(final Context context) {
// ショートカット追加処理}
【dynamic】API Level Check(あたりまえのやつ)
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
// ショートカット情報の設定ShortcutInfo shortcut = new ShortcutInfo.Builder(this, ”shortcut_id_dynamic“)
.setShortLabel(”Web site“)
.setLongLabel(”Open the web site“)
.setIcon(Icon.createWithResource(context, R.drawable.icon_website))
.setIntent(new Intent(Intent.ACTION_VIEW,Uri.parse(”https://www.mysite.example.com/“)) // 遷移先を指定したIntent
).build();
try {// DynamicShortcutsリストをセットshortcutManager.setDynamicShortcuts(Arrays.asList(shortcut));
} catch (IllegalArgumentException iae) {
// if getMaxShortcutCountPerActivity() is exceeded, or when trying to update immutable shortcuts.} catch (IllegalStateException ise) {
// when the user is locked.
}
【dynamic】ShortcutManager
// DynamicShortcutsリストを再構築shortcutManager.setDynamicShortcuts(Arrays.asList(shortcut)); // 既存のリストに追加shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut)); // 既存のDynamicShortcutを更新shortcutManager.updateShortcuts(Arrays.asList(shortcut)); // 任意のDynamicShortcutを削除shortcutManager.removeDynamicShortcuts(Arrays.asList(shortcut));// DynamicShortcut全てを削除shortcutManager.removeAllDynamicShortcuts();
【dynamic】methods
【 Tips 】ShortcutManager#reportShortcutUse
// ショートカットが利用されたときに履歴を残すshortcutManager.reportShortcutUse(”shortcut_id”);
reportShortcutUseを呼んでおくと、履歴閲覧に対応するアプリ(ホームアプリなど)で、履歴の数が多いショートカットを誘導してくれる。(かもしれない)
■API Diff 24→25
Activity
shortcut
shortcut
Fragment
<!-- 遷移先を指定したintent --><intent
android:action=”【独自アクション】“android:targetClass=”【同じActivity】"android:targetPackage=”jp.co.mysample.shortcutsample">
</intent>
同じActivityに対して、ショートカット別に、独⾃Actionを定義して振り分ける
【Tips】⾶び先を同じActivityにしたい場合
Activity
■ 同じActivityのFragmentをショートカット別に開き分けたい場合
■ 共通のActivityで処理した結果によって、別のActivityに⾶ばすような場合
<!-- 遷移先を指定したintent --><intent
android:action=”【独自アクション】“android:targetClass=”【同じActivity】"android:targetPackage=”jp.co.mysample.shortcutsample">
<extra android:name=”from" android:value=”AppShortCuts" /></intent>
extraを定義
【Tips】遷移時のIntentにパラメータを⼊れたい場合
■ ロギングなどのために、任意の画⾯への遷移元を知りたい場合など
Yahoo!ブラウザーでの事例
Yahoo!ブラウザーへ導⼊してみた
□ QRコードリーダー(static)
以下のショートカットを実装
□ ⾳声検索(static)
□ Yahoo!検索(static)
□ よく⾒るサイト(dynamic)
現時点でどのくらい使われているのか■ Android7.1以上のDAU=3,500程度■ 直近のタップ数
各機能、ほぼ5件/⽇以下!0件の⽇もある!
今頑張って実装しなくていいよ!
その他
LauncherAPIもAppShortcuts対応■API Diff 24→25
AppShortcutsに関わるメソッドが追加
まとめ
AppShortcutsで起動導線の幅が広がる!・アイコンにガイドラインあり。
・static/dynamicがある。うまく使いわけましょ。
・履歴に保存しておくとランチャーアプリでうまく露出できるかも。
・Active率(DAU/MAU)の向上に期待したいけど、現時点でユーザーの認知ほぼゼロ。
Thanks!