

Basic Kotlin knowledge (this codelab is in Kotlin).How to show content preview in shared content.

How to make Direct Share backwards compatible with older Android versions.How to implement Direct Share in your app.Add a title and thumbnail to the content preview.Make Direct Share backwards compatible with older Android versions.Publish sharing shortcuts with a specific category.You will implement Direct Share specific logic to: By using the Direct Share feature, this app also publishes some contacts shown in the system Intent chooser dialog.Īll classes and functionality have already been created for you. When a user shares some text from some other app (or the one we're building), this app will be listed as an option. In this codelab, you will work with a messaging app that can receive Intents which contain plain text. This codelab will walk you through implementing Direct Share in your app, including making it backwards compatible with older Android versions. When shown to the user, the system ranks any applicable shortcuts using a prediction service, which shows shortcuts which are more likely to be used. Any published sharing shortcuts are persisted by the system until the app updates them, or the app is uninstalled. To publish share targets, we will use the ShortcutManager API. The app can publish sharing targets in advance, allowing the system Intent chooser dialog to show them when required. In the image, you can see how the user can quickly select Tereasa or Chang to share the text "Hello!" directly to an app using Direct Share, without having to browse through the list of contacts.ĭirect Share works with the concept of Sharing Shortcuts. Direct Share makes sharing content quicker and easier. For example, a messaging app using Direct Share could enable the user to share content direct to a contact, which appears in the chooser dialog. Users can then jump directly into your app when sharing content from another app. Direct Share is a feature that allows apps to show app-specific options directly in the system Intent chooser dialog.
