目录

About This Kit

Share Kit provides cross-app and cross-device sharing of text, images, and videos.

To share content to another app or device through Share Kit, an app needs to send configuration about the content to be shared and its preview style to Share Kit. Share Kit then processes the sharing request based on the scenario:

To receive the shared content, the target app needs to be displayed on the sharing panel. You need to develop the data processing ability and declare it in the target app's configuration file based on the configuration requirements. Social apps can provide contact information through the API of Intents Kit so that a user can share content to a specified contact.

The Sample Code provided by Share Kit showcases the integration mode, examples of text/image sharing, example of Tap to Transfer, and widget templates. You can refer to the sample code to develop your app.

Figure 1 Sharing panel on a phone

Figure 2 Tap to Transfer through Huawei Share across phones

Figure 3 Tap to Transfer between a phone and a PC/2-in-1 device

Basic Concepts

Mechanism

Figure 4 Mechanism of content sharing

App Type Logic
Host app

You need to provide a sharing entry for the content to be shared in the host app. When a user taps Share, the host app needs to send configuration about the shared content to Share Kit and starts the sharing panel.

- Initiating Content Sharing Through the Sharing Panel

- Tap to Transfer

Target app

1. You need to develop a data processing component in the target app. The following sharing methods are available:

- Processing the Shared Content Inside a Target App

- Processing the Shared Content on the Sharing Details Page

2. (Optional) Social apps can provide contact information in recent sharings to Intents Kit based on the Intents Kit integration specifications. Share Kit obtains recommendation information from Intents Kit. When a user selects a recommended contact, Share Kit sends the contact information to the target app together with the shared content. The target app then directly sends the content to the specified user based on the contact information.

Constraints

Emulator Support

This kit is supported on the Emulator.

There are some general differences between the Emulator and real devices. For details, please refer to Differences Between the Emulator and the Real Device.