Pair with QR Code on Device

Last Updated on : 2024-05-17 03:05:22download

This method only applies to devices that are connected to the internet.

Query device UUID

// The URL obtained after the device QR code is scanned.
ThingHomeSdk.getActivatorInstance().deviceQrCodeParse("url", new IThingDataCallback<QrScanBean>() {
            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.


            public void onError(String errorCode, String errorMessage) {
                // errorCode:QR_PROTOCOL_NOT_RECOGNIZED protocol is unknown.


Initialize pairing parameters

ThingQRCodeActivatorBuilder builder = new ThingQRCodeActivatorBuilder()
        .setListener(new IThingSmartActivatorListener() {

                public void onError(String errorCode, String errorMsg) {


                public void onActiveSuccess(DeviceBean devResp) {


                public void onStep(String step, Object data) {



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.

Call the pairing method

IThingActivator mThingActivator = ThingHomeSdk.getActivatorInstance().newQRCodeDevActivator(builder);
// Starts pairing.
// Stops pairing.
// Destroys the pairing task.