目录

numberIdentify (Number Identification Capability Query)

The numberIdentify module allows querying of enterprise call-related capabilities, including checking whether the enterprise caller ID service is enabled, retrieving the states of unknown number identification switches, and obtaining the enterprise information.

Since: 6.1.0(23)

Modules to Import

import { numberIdentify } from '@kit.CallServiceKit';

isSupportEnterpriseNumberIdentify

isSupportEnterpriseNumberIdentify(context: Context): Promise<boolean>

Returns the switch status of the enterprise call display permission, which is displayed on the settings screen. This API uses a promise to return the result.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.0(23)

Parameters:

Parameter Type Mandatory Description
context Context Yes App context.

Returns:

Type Description
Promise<boolean> Promise used to return whether the enterprise call display permission switch has been enabled. true: yes. false: no.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

ID Error Message
8300001 Invalid parameter value.
8300002 The enterprise permission is not verified.
8300003 System internal error.
8300999 Unknown error code.

Example:

import { numberIdentify } from '@kit.CallServiceKit';
import type {common} from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';

let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
let isSupport = await numberIdentify.isSupportEnterpriseNumberIdentify(context);
hilog.info(0, 'TAG', `isSupport:${isSupport}`);

queryNumberIdentifySwitchState

queryNumberIdentifySwitchState(context: Context):SwitchState

Query the status of the unknown number and message identification switch and the status of the app number identification switch.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.0(23)

Parameters:

Parameter Type Mandatory Description
context Context Yes App context.

Returns:

Type Description
SwitchState Queries the status of the unknown number and message identification switch and the status of the app number identification switch that calls this API.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

ID Error Message
8300001 Invalid parameter value.
8300002 The enterprise permission is not verified.
8300999 Unknown error code.

Example:

import type {common} from '@kit.AbilityKit';
import { numberIdentify } from '@kit.CallServiceKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
 
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
let switchState = numberIdentify.queryNumberIdentifySwitchState(context);
hilog.info(0, 'TAG', `switchState is:${JSON.stringify(switchState)}`);

SwitchState

Status of the unknown number and message identification switch and the status of the app number identification switch.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.0(23)

Name Type Read-Only Optional Description
isNumberIdentifyEnabled boolean No No Indicates whether to enable the number identification capability. true: yes. false: no.
isApplicationNumberIdentifyEnabled boolean No No Indicates whether to enable the number identification capability for enterprise apps. true: yes. false: no.
isBusinessServiceDataEnabled boolean No No Indicates whether to enable the service information display capability for enterprise apps. true: yes. false: no. Since: 6.1.1(24)

BusinessServiceData

Enterprise service information.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.1(24)

Name Type Read-Only Optional Description
type BusinessServiceType No No Enterprise service type.
delivery DeliveryData No Yes Express delivery service data.

BusinessServiceType

Enumerates enterprise service types.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.1(24)

Name Value Description
DELIVERY 0 Express delivery.

DeliveryData

Express delivery service data.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.1(24)

Name Type Read-Only Optional Description
customerName string No No Customer name. The value contains fewer than 20 characters. If the value contains more than 20 characters, the first 20 characters are used.
deliveryNumber string No No Express delivery tracking number. The value contains fewer than 20 characters. If the value contains more than 20 characters, the first 20 characters are used.
deliveryStatus string No No Order status. The value contains fewer than 10 characters. If the value contains more than 10 characters, the first 10 characters are used.
deliveryStatusColor DeliveryStatusColor No No Order status color.
deliveryAddress string No No Delivery address. The value contains fewer than 150 characters. If the value contains more than 150 characters, the first 150 characters are used.
deliveryTimeout string No No Delivery timeout interval. The value contains fewer than 20 characters. If the value contains more than 20 characters, the first 20 characters are used.

DeliveryStatusColor

Enumerates order status colors.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Telephony.NumberIdentifyService

Since: 6.1.1(24)

Name Value Description
BLUE 0 Blue.
GREEN 1 Green.
RED 2 Red.