目录

Device Hardware Consistency Check

Use Cases

Enterprise apps can integrate the device hardware consistency check capability to enable automated testing in recycling scenarios. For example, in a trade-in activity, store personnel can use a testing app and call this capability to check the screen, battery, and motherboard of the used device. The testing results directly serve as a key basis for the valuation and recycling decisions. Note that the device must remain connected to the Internet during the testing process to ensure real-time data acquisition and result accuracy.

Constraints

API Description

For details about the APIs, please refer to the API Reference.

API Description
getDeviceComponentVerificationDetails(): Promise<DeviceComponentVerificationResult> Obtains the device hardware consistency verification result. This API uses a promise to return the result.

Development Procedure

  1. Import the required module.

    import { BusinessError } from "@kit.BasicServicesKit";
    import { deviceDetection } from "@kit.ServiceSupportKit";
  2. Call DeviceComponentVerificationResult to define the device hardware information.

    // Create and initialize a result object.
    let result: deviceDetection.DeviceComponentVerificationResult = {
        componentDetails: []
    }
  3. Call getDeviceComponentVerificationDetails to obtain the hardware consistency verification result.

    try {
        // Receive the consistency verification result.
        result = await deviceDetection.getDeviceComponentVerificationDetails();
    } catch (error) {
        // Capture exceptions.
        const err: BusinessError = error as BusinessError;
        console.error('enter into getDeviceComponentVerificationDetails catch, code is: ' + err.code + ' message is: ' + err.message);
    }