शॉर्टकट के लिए सबसे सही तरीके
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
अपने ऐप्लिकेशन के शॉर्टकट डिज़ाइन और बनाते समय, इन दिशा-निर्देशों का पालन करें:
-
डिजाइन से जुड़े दिशा-निर्देशों का पालन करना
-
अपने ऐप्लिकेशन के शॉर्टकट को सिस्टम ऐप्लिकेशन के शॉर्टकट के साथ विज़ुअल तौर पर एक जैसा दिखाने के लिए, ऐप्लिकेशन के शॉर्टकट आइकॉन के डिज़ाइन से जुड़े दिशा-निर्देश पढ़ें.
-
सिर्फ़ चार अलग-अलग शॉर्टकट पब्लिश करना
-
हालांकि, एपीआई आपके ऐप्लिकेशन के लिए ज़्यादा से ज़्यादा 15 स्टैटिक और डाइनैमिक शॉर्टकट के कॉम्बिनेशन के साथ काम करता है, लेकिन हमारा सुझाव है कि आप सिर्फ़ चार अलग-अलग शॉर्टकट पब्लिश करें. इससे लॉन्चर में उनकी विज़ुअल अपीयरेंस बेहतर होगी.
लॉन्चर पर शॉर्टकट दिखाने के साथ-साथ, Google Shortcuts Integration Library का इस्तेमाल करके, Google के प्लैटफ़ॉर्म पर शॉर्टकट दिखाएं. जैसे, Google Assistant. इस लाइब्रेरी की मदद से, डाइनैमिक शॉर्टकट की
अनगिनत संख्या को पुश किया जा सकता है. अगर आपको इस लाइब्रेरी का इस्तेमाल करके, बड़ी संख्या में शॉर्टकट पुश करने हैं, तो हमारा सुझाव है कि आप उन शॉर्टकट की rank
सेट करें जो काम करने वाले लॉन्चर में दिखने चाहिए. इसके लिए, rank
तरीके को कॉल करें.setRank()
-
शॉर्टकट की जानकारी की लंबाई सीमित करना
-
लॉन्चर में, ऐप्लिकेशन के शॉर्टकट दिखाने के लिए मेन्यू में सीमित जगह होती है. अगर मुमकिन हो, तो शॉर्टकट के "छोटे ब्यौरे" की लंबाई 10 वर्णों तक सीमित रखें. साथ ही, "बड़े ब्यौरे" की लंबाई 25 वर्णों तक सीमित रखें.
स्टैटिक शॉर्टकट के लेबल के बारे में ज़्यादा जानने के लिए, एट्रिब्यूट की वैल्यू को पसंद के मुताबिक बनाएं लेख पढ़ें.
डाइनैमिक और पिन किए गए शॉर्टकट के बारे में जानने के लिए, setLongLabel()
और setShortLabel()
पर दिया गया रेफ़रंस दस्तावेज़ पढ़ें.
-
शॉर्टकट और कार्रवाइयों के इस्तेमाल का इतिहास बनाए रखना
-
आपके बनाए गए हर शॉर्टकट के लिए, यह सोचें कि उपयोगकर्ता आपके ऐप्लिकेशन में सीधे तौर पर एक ही टास्क को किन-किन तरीकों से पूरा कर सकता है. इन सभी स्थितियों में reportShortcutUsed()
कॉल करें, ताकि लॉन्चर को यह पता चल सके कि उपयोगकर्ता कितनी बार आपके शॉर्टकट से जुड़ी कार्रवाइयां करता है.
-
शॉर्टकट सिर्फ़ तब अपडेट करें, जब उनका मतलब न बदले
-
डाइनैमिक और पिन किए गए शॉर्टकट बदलते समय, सिर्फ़ ऐसे शॉर्टकट की जानकारी बदलते समय कॉल
updateShortcuts()
करें जिसका मतलब नहीं बदलता. इसके अलावा, यहां दिए गए तरीकों में से किसी एक का इस्तेमाल करें. यह इस बात पर निर्भर करता है कि आपको किस तरह का शॉर्टकट फिर से बनाना है:
उदाहरण के लिए, अगर आपने किसी सुपरमार्केट पर जाने के लिए कोई शॉर्टकट बनाया है, तो सुपरमार्केट का नाम बदलने पर शॉर्टकट को अपडेट करना सही होगा. हालांकि, अगर सुपरमार्केट की जगह नहीं बदलती है, तो शॉर्टकट को अपडेट करने की ज़रूरत नहीं है. हालांकि, अगर उपयोगकर्ता किसी दूसरे सुपरमार्केट से खरीदारी शुरू करता है, तो नया शॉर्टकट बनाना बेहतर होता है.
-
ऐप्लिकेशन लॉन्च करने पर, डाइनैमिक शॉर्टकट की जांच करना
-
जब उपयोगकर्ता अपने डेटा को नए डिवाइस पर वापस लाता है, तब डाइनैमिक शॉर्टकट सेव नहीं होते. इस वजह से, हमारा सुझाव है कि आप अपना ऐप्लिकेशन लॉन्च करते समय, getDynamicShortcuts()
से मिले ऑब्जेक्ट की संख्या की जांच करें. साथ ही, ज़रूरत के मुताबिक डाइनैमिक शॉर्टकट फिर से पब्लिश करें. इसके लिए, बैकअप और रीस्टोर करें में दिए गए कोड स्निपेट का इस्तेमाल करें.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Best practices for shortcuts\n\nWhen designing and creating your app's shortcuts, follow these guidelines:\n\n\n**Follow the design guidelines**\n\n: To make your app's shortcuts visually consistent with the shortcuts used for system apps, follow\n the\n [App Shortcuts Icon Design Guidelines](/static/shareables/design/app-shortcuts-design-guidelines.pdf).\n\n\n**Publish only four distinct shortcuts**\n\n: Although the API supports a combination of up to 15 static and dynamic shortcuts for your app, we\n recommend that you publish only four distinct shortcuts, to improve their visual appearance in the\n launcher.\n\n In addition to displaying shortcuts on the launcher, use the\n [Google Shortcuts Integration Library](/develop/ui/views/launch/shortcuts/creating-shortcuts#gsi-library)\n to display shortcuts on Google surfaces such as Google Assistant. This library supports pushing an\n unlimited number of dynamic shortcuts. If you are using this library to push a large number of\n shortcuts, we recommend setting the `rank` of the shortcuts that must appear in supported\n launchers by calling the\n [](/reference/androidx/core/content/pm/ShortcutInfoCompat.Builder#setRank(int))`setRank()`\n method.\n\n\n**Limit shortcut description length**\n\n: The space in the menu that shows your app's shortcuts in the launcher is limited. When possible,\n limit the length of the \"short description\" of a shortcut to 10 characters and limit the length of\n the \"long description\" to 25 characters.\n\n For more information about labels for static shortcuts, read\n [Customize attribute values](/guide/topics/ui/shortcuts/creating-shortcuts#attribute-values).\n For dynamic and pinned shortcuts, read the reference documentation on\n [setLongLabel()](/reference/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLongLabel(java.lang.CharSequence))\n and\n [setShortLabel()](/reference/androidx/core/content/pm/ShortcutInfoCompat.Builder#setShortLabel(java.lang.CharSequence)).\n\n\n**Maintain shortcut and action usage history**\n\n: For each shortcut you create, consider the different ways a user can accomplish the same task\n directly within your app. Call\n [reportShortcutUsed()](/reference/androidx/core/content/pm/ShortcutManagerCompat#reportShortcutUsed(android.content.Context,%20java.lang.String))\n in each of these situations so that the launcher maintains an accurate history of how frequently a\n user performs the actions representing your shortcuts.\n\n\n**Update shortcuts only when their meaning is retained**\n\n: When changing dynamic and pinned shortcuts, only call\n [updateShortcuts()](/reference/androidx/core/content/pm/ShortcutManagerCompat#updateShortcuts(android.content.Context,%20java.util.List%3Candroidx.core.content.pm.ShortcutInfoCompat%3E))\n when changing the information of a shortcut that retains its meaning. Otherwise, use one of the\n following methods, depending on the type of shortcut you're recreating:\n\n - Dynamic shortcuts: [pushDynamicShortcut()](/reference/androidx/core/content/pm/ShortcutManagerCompat#pushDynamicShortcut(android.content.Context,%20androidx.core.content.pm.ShortcutInfoCompat)).\n - Pinned shortcuts: [requestPinShortcut()](/reference/androidx/core/content/pm/ShortcutManagerCompat#requestPinShortcut(android.content.Context,%20androidx.core.content.pm.ShortcutInfoCompat,%20android.content.IntentSender)).\n\n For example, if you create a shortcut for navigating to a supermarket, it is appropriate to\n update the shortcut if the name of the supermarket changes but its location stays the same. If the\n user begins shopping at a different supermarket location, however, it's better to create a new\n shortcut.\n\n\n**Check dynamic shortcuts whenever you launch your app**\n\n: Dynamic shortcuts aren't preserved when the user restores their data onto a new device. For this\n reason, we recommend that you check the number of objects returned by\n [getDynamicShortcuts()](/reference/androidx/core/content/pm/ShortcutManagerCompat#getDynamicShortcuts(android.content.Context))\n each time you launch your app and re-publish dynamic shortcuts as needed, as shown in the code\n snippet in\n [Backup and restore](/guide/topics/ui/shortcuts/managing-shortcuts#backup-restore)."]]