public interface IContinuationRegisterManager
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
disconnect() |
Disconnects from the hop task management service.
|
void |
register(String bundleName,
ExtraParams parameter,
IContinuationDeviceCallback deviceCallback,
RequestCallback requestCallback) |
Registers an ability to be hopped with the hop task management service and obtains the registration token
assigned to the ability.
|
void |
showDeviceList(int token,
ExtraParams parameter,
RequestCallback requestCallback) |
Shows the list of devices that can be selected for ability hopping on the distributed network.
|
void |
unregister(int token,
RequestCallback requestCallback) |
Unregisters a specified ability from the hop task management service based on the token obtained during ability
registration.
|
void |
updateConnectStatus(int token,
String deviceId,
int status,
RequestCallback requestCallback) |
Updates the connection state of the device where the specified ability is successfully hopped.
|
void register(String bundleName, ExtraParams parameter, IContinuationDeviceCallback deviceCallback, RequestCallback requestCallback)
You can use IContinuationDeviceCallback to listen for the device connection state changes after the
user selects a device for ability hopping and implement your own processing logic. When the device is
connected, IContinuationDeviceCallback#onConnected is called to initiate the ability hopping
process; when the device is disconnected, IContinuationDeviceCallback#onDisconnected is called
to perform related operations, for example, notify the user of the disconnection. In addition, you can obtain
the registration token via RequestCallback#onResult.
To use this method, you must dynamically request the ohos.permission.DISTRIBUTED_DATASYNC permission
from the user. The ohos.permission.DISTRIBUTED_DATASYNC permission is of the user_grant level.
bundleName - Indicates the bundle name of the application whose ability is to be hopped.parameter - Indicates the ExtraParams object containing the extra parameters used to filter
the list of available devices. This parameter can be null.deviceCallback - Indicates the callback to be invoked when the connection state of the selected device
changes.requestCallback - Indicates the callback to be invoked when the hop task management service is connected.void unregister(int token,
RequestCallback requestCallback)
token - Indicates the registration token of the ability.requestCallback - Indicates the callback to be invoked when the hop task management service is connected.
This parameter can be null.void updateConnectStatus(int token,
String deviceId,
int status,
RequestCallback requestCallback)
After the hopping is successful, you can call this method in the UI thread to update the connection state of the hopped ability and the device connection state on the screen showing available devices.
token - Indicates the registration token of the ability.deviceId - Indicates the ID of the device whose connection state is to be updated.status - Indicates the connection state to update, which can be DeviceConnectState#FAILURE,
DeviceConnectState#IDLE, DeviceConnectState#CONNECTING, DeviceConnectState#CONNECTED,
or DeviceConnectState#DIS_CONNECTING.requestCallback - Indicates the callback to be invoked when the hop task management service is connected.
This parameter can be null.void showDeviceList(int token,
ExtraParams parameter,
RequestCallback requestCallback)
token - Indicates the registration token of the ability.parameter - Indicates the ExtraParams object containing the extra parameters used to filter
the list of available devices. This parameter can be null.requestCallback - Indicates the callback to be invoked when the hop task management service is connected.
This parameter can be null.void disconnect()
You can call this method when the application is exiting.