# ActivateDevice

All other interfaces need to be called successfully before they can be used. If they fail, try again.

For activating the device.every time WMPF Startup should be called, the expiration date is the same as the WMPF Service The process life cycle is consistent.

# Call parameter

In completing theAccess processAfter all the steps in the productIdkeyVersiondeviceIdsignature

attribute Required type Introductions Minimum version
productId yes int product id
keyVersion yes int Key version
deviceId yes string equipment id
signature yes string Signature (no newline needed)
hostAppId yes string Mobile App's AppId ,WeChat Open PlatformApply
features no string[] Declare the attributes used. Currently supported: voip-device WMPF 1.2.0

# features

# Return parameters

attribute Introductions
invokeToken Call the voucher for subsequent actions

# sample code

val request = WMPFActivateDeviceRequest().apply {
    this.baseRequest = WMPFBaseRequestHelper.checked()
    this.productId = 初始值
    this.keyVersion = keyVerion
    this.deviceId = deviceId
    this.signature = signature.replace(Regex("[trn]"), "")
    this.hostAppId = hostAppId
}

val result =
    WMPFIPCInvoker.invokeAsync<IPCInvokerTask_ActivateDevice, WMPFActivateDeviceRequest, WMPFActivateDeviceResponse>(
        request,
        IPCInvokerTask_ActivateDevice::class.java,
        object : IPCInvokeCallbackEx<WMPFActivateDeviceResponse> {
            override fun onBridgeNotFound() {
                it.onError(Exception("bridge not found"))
            }

            override fun onCallback(response: WMPFActivateDeviceResponse) {
                if (isSuccess(response)) {
                    if (response != null && !response.invokeToken.isNullOrEmpty()) {
                        initInvokeToken(response.invokeToken)
                    }

                    it.onSuccess(response)
                } else {
                    it.onError(TaskErrorException(createTaskError(response)))
                }
            }

            override fun onCaughtInvokeException(exception: java.lang.Exception?) {
                if (exception != null) {
                    it.onError(exception)
                } else {
                    it.onError(java.lang.Exception("null"))
                }
            }
        })

if (!result) {
    it.onError(Exception("invoke activateDevice fail"))
}

# Be careful

  • Highly Recommended Registration onBridgeNotFound 、onCallback Failure callback. Once activation fails, try again.
  • Can be passed first ActiveStatus Determine if the device is activated.
  • signature err This means that the parameters in the signature do not match the parameters passed in this interface. In the event that the signature is correct, it is recommended to follow the following guidelines:
    • confirm WMPF Upgrade to v1.1.5 And above versions
    • When the signature is generated. productId、deviceId And the version of the key used(keyVersion) and ActivateDevice The parameters passed in are consistent.
    • Of the signature environment when the signature is generated in the developer background openssl Version recommended 1.1.1, Determined 1.0.x and 3.0.x Version will have problems, other versions developers can try it on their own.
  • Successful signature verification can only indicate that the parameters contained in the signature are consistent with the parameters provided at the time of verification. ActivateDevice No error.