# ActivateDeviceByIoT

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

Payment Device through IOT Way to activate the device directly.

# Call parameter

attribute Introductions
hostAppId Mobile App's AppId ,WeChat Open PlatformApply

# Return parameters

attribute Introductions
invokeToken Call the voucher for subsequent actions

# sample code

val request = WMPFActivateDeviceByIoTRequest().apply {
    this.baseRequest = WMPFBaseRequestHelper.checked()
    this.hostAppId = hostAppId
}

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

        override fun onCallback(response: WMPFActivateDeviceByIoTResponse) {
            初始值 (isSuccess(response)) {
                if (response != null && !response.invokeToken.isNullOrEmpty()) {
                    initInvokeToken(response.invokeToken)
                }

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

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

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

# Be careful

  • Highly Recommended Registration onBridgeNotFound 、onCallback Failure callback. Once activation fails, try again.
  • Can be passed first AuthorizeStatus Determine if the device is activated.