Kısayollar için en iyi uygulamalar
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Uygulamanızın kısayollarını tasarlarken ve oluştururken aşağıdaki yönergeleri izleyin:
-
Tasarım yönergelerine uyun
-
Uygulamanızın kısayollarını, sistem uygulamaları için kullanılan kısayollarla görsel olarak tutarlı hale getirmek için Uygulama Kısayolları Simge Tasarım Yönergeleri'ni izleyin.
-
Yalnızca dört farklı kısayol yayınlama
-
API, uygulamanız için 15'e kadar statik ve dinamik kısayolun bir kombinasyonunu desteklese de, başlatıcıdaki görsel görünümlerinin iyileştirilmesi için yalnızca dört ayrı kısayol yayınlamanızı öneririz.
Kısayolları başlatıcıda görüntülemenin yanı sıra Google Asistan gibi Google yüzeylerinde görüntülemek için Google Kısayollar Entegrasyon Kitaplığı'nı kullanın. Bu kitaplık, sınırsız sayıda dinamik kısayol aktarmayı destekler. Bu kitaplığı çok sayıda kısayolu uygulamak için kullanıyorsanız setRank()
yöntemini çağırarak desteklenen başlatıcılarda görünmesi gereken kısayolların rank
kadarını ayarlamanızı öneririz.
-
Kısayol açıklamasının uzunluğunu sınırlama
-
Menüde, başlatıcıda uygulamanızın kısayollarını gösteren alan sınırlıdır. Mümkün olduğunda bir kısayolun "kısa açıklamasının" uzunluğunu 10 karakterle, "uzun açıklamanın" ise uzunluğunu 25 karakterle sınırlandırın.
Statik kısayol etiketleri hakkında daha fazla bilgi için Özellik değerlerini özelleştirme konusunu okuyun.
Dinamik ve sabitlenmiş kısayollar için setLongLabel()
ve setShortLabel()
ile ilgili referans belgelerini okuyun.
-
Kısayol ve işlem kullanım geçmişini koruma
-
Oluşturduğunuz her kısayol için bir kullanıcının aynı görevi doğrudan uygulamanızda gerçekleştirebileceği farklı yolları düşünün. Bu durumların her birinde
reportShortcutUsed()
çağrısını çağırarak başlatıcının, bir kullanıcının kısayollarınızı temsil eden işlemleri ne sıklıkta yaptığı hakkında doğru bir geçmiş bilgisi tutmasını sağlayın.
-
Kısayolları yalnızca anlamları korunduğunda güncelleme
-
Dinamik ve sabitlenmiş kısayolları değiştirirken, yalnızca
updateShortcuts()
kodunu, anlamını koruyan bir kısayolun bilgilerini değiştirirken çağırın. Aksi takdirde, yeniden oluşturduğunuz kısayolun türüne bağlı olarak aşağıdaki yöntemlerden birini kullanın:
Örneğin, bir süpermarkete gitmek için kısayol oluşturursanız, adı değişip konumu aynı kalırsa kısayolu güncellemeniz uygun olur. Ancak, kullanıcı farklı bir süpermarket konumundan alışverişe başlarsa yeni bir kısayol oluşturmak daha iyi olur.
-
Uygulamanızı her başlattığınızda dinamik kısayolları kontrol etme
-
Kullanıcı, verilerini yeni bir cihaza geri yüklediğinde dinamik kısayollar korunmaz. Bu nedenle, uygulamanızı her başlattığınızda getDynamicShortcuts()
tarafından döndürülen nesnelerin sayısını kontrol etmenizi ve Yedekleme ve geri yükleme bölümündeki kod snippet'inde gösterildiği gibi, gerektiğinde dinamik kısayolları yeniden yayınlamanızı öneririz.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 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)."]]