VoIPExtensionAbility is an extension ability for in-app call messages. It inherits from UIExtensionAbility and adds a callback for obtaining scenario-specific message data. The restrictions are as follows:
VoIPExtensionAbility is a lightweight, independent child process.
The child process cannot call widget APIs.
If this extension ability fails to be executed, an error may be returned. Rectify the fault based on the error information. For details, please refer to ArkTS API Error Codes.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Push.PushService
Since: 4.1.0(11)
Deprecated since: 26.0.0
To ensure system security and stability and prevent VoIPExtensionAbility from abusing system resources, the system restricts its capabilities. Referencing certain modules is not supported. For details, please refer to the Appendix.
Model restriction: This attribute can be used only in the stage model.
System capability: SystemCapability.Push.PushService
Since: 4.1.0(11)
Deprecated since: 26.0.0
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| context | VoIPExtensionContext(deprecated) | No | No | Context of VoIPExtensionAbility, which inherits from UIExtensionContext. |
onReceiveMessage(voipInfo: pushCommon.VoIPInfo): void
API for receiving in-app call messages after an app inherits from VoIPExtensionAbility.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Push.PushService
Since: 4.1.0(11)
Deprecated since: 26.0.0
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| voipInfo | pushCommon.VoIPInfo | Yes | VoIP call message data. |
Example:
import { VoIPExtensionAbility, pushCommon } from '@kit.PushKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
const LOG_DOMAIN = 0x0000;
const LOG_TAG = 'VoIPExtensionAbility';
export default class VoipExtAbility extends VoIPExtensionAbility {
// voipInfo indicates scenario-specific message data.
onReceiveMessage(voipInfo: pushCommon.VoIPInfo): void {
hilog.info(LOG_DOMAIN, LOG_TAG, 'VoipExtAbility onReceiveMessage');
}
} VoIPExtensionAbility does not support referencing the following modules.