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