Class Info |
|---|
public class ShareKitManager |
Share Engine management class used to call the Share Engine capabilities. |
Constructor name |
|---|
ShareKitManager(@NonNull Context context) Constructs a ShareKitManager instance. |
Qualifier and Type | Method Name and Description |
|---|---|
void | init(IShareKitInitCallback callback) Initializes Share Engine capabilities. |
void | uninit() Releases Share Engine capabilities. |
int | Obtains the Share Engine capability status. |
int | enable() Enables Bluetooth and Wi-Fi. |
int | Starts to discover devices. |
int | Stops discovering devices. |
List<NearByDeviceEx> | Obtains the devices processing sharing. |
int | registerCallback(IWidgetCallback callback) Registers a callback API. |
int | unregisterCallback(IWidgetCallback callback) Unregisters a callback API. |
int | doSend(NearByDeviceEx device, ShareBean bean) Sends shared content. |
int | cancelSend(NearByDeviceEx device) Cancels sending. |
int | Sets the device to be discoverable. |
int | Sets the device to be non-discoverable. |
void | setWifiP2pManagerEx(IWifiP2pManagerEx wifiP2pManagerEx) Sets the southbound API (required for non-Huawei phones to receive shared content through Wi-Fi Direct). |
void | Clears the southbound API. |
constructor |
|---|
ShareKitManager(@NonNull Context context) |
Constructs a ShareKitManager instance. |
Parameters
Name | Description |
|---|---|
context | App context. |
Method |
|---|
void init(IShareKitInitCallback callback) |
Initializes Share Engine capabilities. |
Parameters
Name | Description |
|---|---|
callback | Callback instance for ShareKitManager initialization. |
Method |
|---|
int getShareStatus() |
Obtains the Share Engine capability status. |
Return
Type | Description |
|---|---|
int | 0: Normal Result code: For details, please refer to the description in KitResult. |
Method |
|---|
int enable() |
Enables Bluetooth and Wi-Fi. |
Return
Type | Description |
|---|---|
int | Result code: For details, please refer to the description in KitResult. |
Method |
|---|
int startDiscovery() |
Starts to discover devices. |
Return
Type | Description |
|---|---|
int | Result code: For details, please refer to the description in KitResult. |
Method |
|---|
int stopDiscovery() |
Stops discovering devices. |
Return
Type | Description |
|---|---|
int | Result code: For details, please refer to the description in KitResult. |
Method |
|---|
List<NearByDeviceEx> getDeviceList() |
Obtains the devices processing sharing. |
Return
Type | Description |
|---|---|
List<NearByDeviceEx> | List of the devices processing sharing. |
Method |
|---|
int registerCallback(IWidgetCallback callback) |
Registers a callback API. |
Parameters
Name | Description |
|---|---|
callback | Callback instance for Share Engine. |
Return
Type | Description |
|---|---|
int | Result code. For details, please refer to the section "KitResult". |
Method |
|---|
int unregisterCallback(IWidgetCallback callback) |
Unregisters a callback API. |
Parameters
Name | Description |
|---|---|
callback | Callback instance for Share Engine. |
Return
Type | Description |
|---|---|
int | Result code. For details, please refer to the section "KitResult". |
Method |
|---|
int doSend(NearByDeviceEx device, ShareBean bean) |
Sends shared content. |
Parameters
Name | Description |
|---|---|
device | ID of the peer device. |
bean | Shared information. |
Return
Type | Description |
|---|---|
int | Result code. For details, please refer to the section "KitResult". |
Method |
|---|
int cancelSend(NearByDeviceEx device) |
Cancels sending. |
Parameters
Name | Description |
|---|---|
device | ID of the peer device. |
Return
Type | Description |
|---|---|
int | Result code. For details, please refer to the section "KitResult". |
Method |
|---|
int startDiscoverable() |
Sets the device to be discoverable. |
Return
Type | Description |
|---|---|
int | Result code. For details, please refer to the section "KitResult". |
Method |
|---|
int stopDiscoverable () |
Sets the device to be non-discoverable. |
Return
Type | Description |
|---|---|
int | Result code. For details, please refer to the section "KitResult". |