Last Updated on : 2024-05-17 03:05:22download
This method only applies to devices that are connected to the internet.
// The URL obtained after the device QR code is scanned.
ThingHomeSdk.getActivatorInstance().deviceQrCodeParse("url", new IThingDataCallback<QrScanBean>() {
@Override
public void onSuccess(QrScanBean result) {
if(result != null){
// Get uuid from result.actionData. This parameter will be used as the request parameter in the subsequent pairing process.
}
}
@Override
public void onError(String errorCode, String errorMessage) {
// errorCode:QR_PROTOCOL_NOT_RECOGNIZED protocol is unknown.
}
});
ThingQRCodeActivatorBuilder builder = new ThingQRCodeActivatorBuilder()
.setUuid(uuid)
.setHomeId(homeId)
.setContext(mActivity)
.setTimeOut(timeout)
.setListener(new IThingSmartActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
}
@Override
public void onStep(String step, Object data) {
}
}
));
Parameters
Parameter | Description |
---|---|
uuid | The UUID that is returned after a device QR code is scanned. |
homeId | The home ID. For more information about how to get the value, see Home Management. |
timeout | The timeout value of a pairing task. Default value: 100 . Unit: seconds. |
IThingActivator mThingActivator = ThingHomeSdk.getActivatorInstance().newQRCodeDevActivator(builder);
// Starts pairing.
mThingActivator.start();
// Stops pairing.
mThingActivator.stop();
// Destroys the pairing task.
mThingActivator.onDestory();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback