public interface IAbilityConnection
You must override the methods of this interface to implement your processing logic for the connection and disconnection of an ability using the Service template (Service ability for short).
SystemCapability.Aafwk#ABILITY| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
onAbilityConnectDone(ElementName element,
IRemoteObject remote,
int resultCode) |
Called back after an ability connects to a Service ability.
|
void |
onAbilityDisconnectDone(ElementName element,
int resultCode) |
Called back after the connected Service ability crashes or is killed.
|
void onAbilityConnectDone(ElementName element, IRemoteObject remote, int resultCode)
This method is called back to receive the connection result after an ability calls the
Ability#connectAbility(Intent, IAbilityConnection) method to connect it to a Service ability.
element - Indicates information about the connected Service ability.remote - Indicates the remote proxy object of the Service ability.resultCode - Indicates the connection result code. The value 0 indicates a successful connection,
and any other value indicates a connection failure.Ability.connectAbility(Intent, IAbilityConnection)void onAbilityDisconnectDone(ElementName element, int resultCode)
This method is called back to receive the disconnection result after the connected Service ability crashes
or is killed. If the Service ability exits unexpectedly, all its connections are disconnected, and each ability
previously connected to it will call onAbilityDisconnectDone(ohos.bundle.ElementName,int).
element - Indicates information about the disconnected Service ability.resultCode - Indicates the disconnection result code.Ability.disconnectAbility(IAbilityConnection)