Bowyer Tech Blog



How to make App Shortcuts

投稿日:2017年3月8日 更新日:

If app targets Android 7.1(API level 25) or higher, we can define App Shortcuts.

In this post, introduce you What is App Shortcuts, How to implementation that and whether or not  has been actually used that.

What are App Shortcuts?

App Shortcuts

App Shortcuts is the shortcut that can use at the launcher.

According to Google’s API Guide, there are examples of usage as follows.

  • Navigating users to a particular location in a mapping app.
  • Sending messages to a friend in a communication app.
  • Playing the next episode of a TV show in a media app.
  • Loading the last save point in a gaming app.

Each of  shortcuts provides specific action in your app, when user selects the one.

How to implement App Shortcuts

We can publish two different types of shortcuts for our app.The one is Static, the other is Dynamic.

build.gladle settings

As mentioned at the beginning, App Shortcuts needs Android 7.1(API level 25).

Write targetSdkVersion 25 to build.gradle like this.

Static Shortcuts

Static shortcut is a shortcut that will not be changed depending on the state of the app etc.

Example of Static Shortcuts


No matter what you have many google account or not,Camera app no need to change short cut.

So, you should choice Static shortcuts.

Static shortcuts is easy to introduce.

Create shortcuts.xml

You create shortcuts.xml under res/xml/shortcuts.xml.

Add meta-data to AndroidManifest.xml

You need to write it between activity tag.And the activity tag need android.intent.action.MAIN action and android.intnet.category.LAUNCHER category.

If not contains that action or category, can’t launch from App Shortcuts.

Dynamic Shortcuts

Dynamic shortcuts is a shortcut that will be changed depending on the state of the app etc.

Example of Dynamic Shortcuts

If you have three Google Accounts, Gmail app’s  shows four shortcuts.

One is create new mail,the other shortcuts create new mail with selected account.

In this case you need to create it dynamically.

Dynamic shortcuts is easy to introduce too.

Get ShortcutManager

First get ShortcutManager instance from systemservice.

Second create ShortcutInfo as many as you need.

Put Activity.class into the Intent  as you want to launch.

Last set these shortcutInfos as a list to the shortcutManager instance.

That’s all.

ShortcutManager needs API level 25, if your apps support lowyer than API level 25.Devide these process another method, and add @TargetApi(25).And  before call method, you should check if API level is higher than 25.


Example of App Shortcuts

Navigation Drawer


This is my app KyudoScoreBook.This app have NavigationDrawer.

I want to set these menu to App Shortcuts.

NavigationDrawer usually one Activity controls some Fragments.

App ShortCuts or googlesamples/android-AppShortcuts isn’t introduce how to call Activity with intent that has extra values about Static Shortcuts.

I found the solution of these problem.

Put extra values into intent of Static Shortcuts xml

First put extra values into intent of Static Shortcuts xml.

Intent tag can include extra value like this.


Handle intent

Second, handle intent and catch extra values at MainActivity.

※All of App Shortcuts calls MainActivity about my apps.


Change Fragment

Last, depending on the extra value to change the fragment.

That’s all.

This is my sample code about App Shortcuts.

Actually used App Shortcuts?

It is doubtful whether it is really used.

I will show you my apps analytics data of App Shortcuts events.

Information for the B for reference KyudoScoreBook.

■Total downloads : 15,000

■DAU : 1,000

■Android 7.1 user : 1%(10 people /day)

App Shortcuts event

It is not used at all lol.




僕が実践したGoogle Analyticsのトラッキングログ実装

エンジニアもGoogle Analyticsを使ってデータに向きあうべき理由で、エンジニアもデータに向き合ったほうがよいと紹介しました。 この記事では、私の公開している採点簿というAndroidアプリ …


AndroidアプリはGoogle Play Storeのレビューが積み上がり式なので、一度低評価なレビューがついてしまうと評価をあげることは難しいです。かと言って、インセンティブをバラまいて故意に高 …


近年、デザイナーもAndroidアプリやiOSアプリのレイアウトを自分で修正する時代になってきました。ある企業では、Androidエンジニアが大枠のレイアウトを組んで、マージンや色の微調整などはデザイ …

データで見る3D TouchやApp Shortcutsの利用状況

iOS9から追加された3D Touchはリリースから1年以上経ったので、すでに実装されている方も多いでしょう。Android7.1より追加されたApp Shortcutsはまだ7.1のOSが一般ユーザ …


google play serviceを9.8.0にしてから一部の端末で起動直後にクラッシュすると報告がありました。クラッシュログによるとAdvertisingIdClient#getAdvertis …