Create an Assist Request (LCC.assist.create)
Declaration
task, err = LCC.assist.create(options)
Parameters
- options
Table. Assist request configuration. See Common Options and Return Objects.
Return Values
- task
Table ornil. The control-center task object on success. - err
String ornil. Failure reason.
Notes
Creates the task only and does not wait for a human result.
IfscreenshotLocalPathis provided, the SDK uploads the local device screenshot before creating the task.
IfscreenshotImageorscreenshotImageDatais provided, the SDK converts it to a data URL and sends it in the request body without saving a file first.
After successful creation, the task is tracked as an unfinished request for the current script and can later be cleaned up bycancel_all().
Script-created tasks automatically setdeviceId = device.udid()andsource = "lua-script".
Example
local task, err = LCC.assist.create({
type = "control",
title = "Handle verification",
text = "Remote-control the device, finish the current verification, then click Done",
timeout = 300,
})
if not task then
nLog("failed to create assist request", err)
return
end
local result, waitErr = LCC.assist.wait(task.id, 300, 1000)
if not result then
nLog("assist request not completed", waitErr)
end