Skip to content

Commit 25e21df

Browse files
Initial commit
1 parent 2b60ee4 commit 25e21df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ In Android `7.1(API 25)` new [ShortcutManager](https://developer.android.com/ref
5656
- Dynamic shortcuts are context sensitive and are displayed by launchers like nova launcher by long pressing the app icon and only exist in android `>=7.1`. Android apps can register dynamic shortcuts with the `ShortcutManager` at runtime by sending a list of [ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo) objects to [ShortcutManager.addDynamicShortcuts()](https://developer.android.com/reference/android/content/pm/ShortcutManager#addDynamicShortcuts(java.util.List%3Candroid.content.pm.ShortcutInfo%3E)) function. Each `ShortcutInfo` contains information like the icon, label, the real intent and any extras that will be sent when that shortcut will be requested to be launched by the launcher. These shortcuts can be queried by the launcher apps using the [LauncherApps.getShortcuts()](https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcuts(android.content.pm.LauncherApps.ShortcutQuery,%20android.os.UserHandle)) function and passing the [FLAG_MATCH_DYNAMIC](https://developer.android.com/reference/android/content/pm/LauncherApps.ShortcutQuery#FLAG_MATCH_DYNAMIC) query flag.
5757

5858
- Pinned shortcuts are sent by apps to the launcher when you press buttons like `Add to Home screen`, like pinning a website or chat shortcut on the launcher home.
59-
- In android `<8`, apps can send shortcuts to be pinned to the launchers with a broadcast intent with the `com.android.launcher.action.INSTALL_SHORTCUT` action, `EXTRA_SHORTCUT_INTENT` intent extra and `EXTRA_SHORTCUT_NAME` string extra using [Context.sendBroadcast](https://developer.android.com/reference/android/content/Context#sendBroadcast(android.content.Intent)) function. The launcher apps can register a `BroadcastReceiver` with the `com.android.launcher.permission.INSTALL_SHORTCUT` permission and `com.android.launcher.action.INSTALL_SHORTCUT` action to receive these shortcuts. This is [no longer supported](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/oreo-release/services/core/java/com/android/server/am/ActivityManagerService.java#19328) in android `>=8`.
59+
- In android `<8`, apps can send shortcuts to be pinned to the launchers with a broadcast intent with the `com.android.launcher.action.INSTALL_SHORTCUT` action, `EXTRA_SHORTCUT_INTENT` intent extra and `EXTRA_SHORTCUT_NAME` string extra using [Context.sendBroadcast()](https://developer.android.com/reference/android/content/Context#sendBroadcast(android.content.Intent)) function. The launcher apps can register a `BroadcastReceiver` with the `com.android.launcher.permission.INSTALL_SHORTCUT` permission and `com.android.launcher.action.INSTALL_SHORTCUT` action to receive these shortcuts. This is [no longer supported](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/oreo-release/services/core/java/com/android/server/am/ActivityManagerService.java#19328) in android `>=8`.
6060
- In android `>=8`, apps can send shortcuts to be pinned to the launchers by creating a `ShortcutInfo` object and sending it to the [ShortcutManager.requestPinShortcut()](https://developer.android.com/reference/android/content/pm/ShortcutManager#requestPinShortcut(android.content.pm.ShortcutInfo,%20android.content.IntentSender)) function. The launcher apps can declare an `Activity` with the `android.content.pm.action.CONFIRM_PIN_SHORTCUT` [intent-filter](https://developer.android.com/guide/topics/manifest/intent-filter-element) to receive and confirm these shortcuts. The shortcuts owned by the launcher apps can be queried using the [LauncherApps.getShortcuts()](https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcuts(android.content.pm.LauncherApps.ShortcutQuery,%20android.os.UserHandle)) function and passing the [FLAG_MATCH_PINNED](https://developer.android.com/reference/android/content/pm/LauncherApps.ShortcutQuery#FLAG_MATCH_PINNED) query flag.
6161

6262
Android docs are really really shitty for creating launchers, had to go through android default AOSP [launcher](https://android.googlesource.com/platform/packages/apps/Launcher3/+/refs/heads/master) [port](https://github.com/amirzaidi/Launcher3) and [Nova Launcher](https://play.google.com/store/apps/details?id=com.teslacoilsw.launcher&hl=en) source codes to figure lot of stuff out.

0 commit comments

Comments
 (0)