1
2Android AppShortcuts Sample
3===================================
4
5This sample demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25).
6This API allows an application to define a set of Intents which are displayed as when a user
7long-presses on the app's launcher icon. Examples are given for registering both links both
8statically in XML, as well as dynamically at runtime.
9
10Introduction
11------------
12
13You can use the shortcuts feature in Android 7.1 (API 25) to bring users from the launcher
14directly to key actions within your app. Users simply long-press your app's launcher icon
15to reveal the app's shortcuts, then tap on a shortcut to jump to the associated action.
16These shortcuts are a great way to engage users, and they let you surface the functionality
17of your app even before users launch your app.
18
19Each shortcut references an intent, each of which launches a specific action or task, and
20you can create a shortcut for any action that you can express as an intent. For example, you
21can create intents for sending a new text message, making a reservation, playing a video,
22continuing a game, loading a map location, and much more.
23
24You can create shortcuts for your app statically by adding them to a resource file in the APK,
25or you can add them dynamically at runtime. Static shortcuts are ideal for common actions,
26and dynamic shortcuts let you highlight actions based on users' preferences, behavior, location,
27and so on. This sample demonstrates both types of shortcuts.
28
29You can offer up to five shortcuts in each of your apps.
30
31After your app adds shortcuts, they're available on any launcher that supports them, such as the
32Pixel launcher (the default launcher on Pixel devices), the Now launcher (the default launcher on
33Nexus devices), and other launchers that provide support.
34
35For more information on creating shortcuts, see the [Shortcuts to App Actions][1] developer guide.
36
37[1]: https://developer.android.com/preview/shortcuts.html
38
39Pre-requisites
40--------------
41
42- Android SDK 27
43- Android Build Tools v27.0.2
44- Android Support Repository
45
46Screenshots
47-------------
48
49<img src="screenshots/screenshot-1.png" height="400" alt="Screenshot"/>
50
51Getting Started
52---------------
53
54This sample uses the Gradle build system. To build this project, use the
55"gradlew build" command or use "Import Project" in Android Studio.
56
57Support
58-------
59
60- Google+ Community: https://plus.google.com/communities/105153134372062985968
61- Stack Overflow: http://stackoverflow.com/questions/tagged/android
62
63If you've found an error in this sample, please file an issue:
64https://github.com/googlesamples/android-AppShortcuts
65
66Patches are encouraged, and may be submitted by forking this project and
67submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
68
69License
70-------
71
72Copyright 2017 The Android Open Source Project, Inc.
73
74Licensed to the Apache Software Foundation (ASF) under one or more contributor
75license agreements.  See the NOTICE file distributed with this work for
76additional information regarding copyright ownership.  The ASF licenses this
77file to you under the Apache License, Version 2.0 (the "License"); you may not
78use this file except in compliance with the License.  You may obtain a copy of
79the License at
80
81http://www.apache.org/licenses/LICENSE-2.0
82
83Unless required by applicable law or agreed to in writing, software
84distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
85WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
86License for the specific language governing permissions and limitations under
87the License.
88