MANUEL VIVO: In Android Q, we are improving the ShareSheet. We're introducing a new sharing shortcuts API that makes Direct Share lightning-fast. Also, there is a new content preview for text, images, and files.
Direct Share is a feature that allows apps to show app-specific options directly in the ShareSheet. Those options are called Sharing Shortcuts. For example, a messaging app using it can enable the user to share content to a contact directly. While the Direct Share feature is still supported, the legacy Direct Share API is now deprecated.
Going forward, you will use the new Sharing Shortcuts API. Unlike the deprecated APIs, Sharing Shortcuts are published in advance, making the ShareSheet load instantly when launched. This is similar to how the ShortcutManner API works. That's why we've expanded the ShortcutInfo API to make the integration of both features easier. The new Sharing Shortcuts API is also supported in the new ShareTarget AndroidX library. That makes Direct Share backwards-compatible down to Android M. Taking into account that sharing target's implemented with the legacy Direct Share API will be deprioritized in Android Q, meaning that they will appear after the ones published with the new API.
Using the ShortcutManagerCompat class from the support library is the preferred way to publish Sharing Shortcuts. That will work on older Android versions without any extra work needed. Follow these steps to publish Sharing Shortcuts using the new API.
First, declare share target elements in your shortcuts.xml file. And add the metadata to your main activity in the Android manifest file. Secondly, publish dynamic shortcuts to the already declared share targets using this Shortcut Manager API. Lastly, to make it backwards-compatible, add this metadata tag to the activity that will handle the shared intent. That's all. Without Direct Share, this is how your app would look like. With the new changes and support for the new content preview, this is how the ShareSheet has changed. Now users can jump straight into your app when sharing content from another app. To find out more about Direct Share, check out the code lab and the documentation. All links below. Thanks for watching. [MUSIC PLAYING] .