public class AbilityAgent extends Object
Ability#startAssistAbility method, the framework returns the agent object of
the peer ability to your application.| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
sendEvent(InnerEvent event) |
Sends messages to the peer ability.
|
void |
setLifecycleObserver(ILifecycleObserver lifeObserver) |
Registers a lifecycle callback of the peer ability.
|
void |
setReceivedEventHandler(EventHandler handler) |
Registers a handler for processing messages from the peer ability.
|
public void setLifecycleObserver(ILifecycleObserver lifeObserver)
Passing in null will unregister the lifecycle callback.
lifeObserver - Indicates an observer used to receive lifecycle events of the peer ability.ILifecycleObserverpublic void setReceivedEventHandler(EventHandler handler)
handler - Indicates a handler used to process messages from the peer ability.EventHandlerpublic int sendEvent(InnerEvent event)
event - Indicates the message to send to the peer ability.AssistantCode#OK if the message is sent
successfully; returns an error code defined in AssistantCode otherwise.InnerEvent