Last Updated on : 2024-05-27 06:34:29download
This topic describes how to enable a device with a camera to scan the QR code on the mobile app for pairing.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
mode | ActivatorMode | Yes | The pairing mode. |
Example
QRActivator qrActivator = (QRActivator) ActivatorService.activator(ActivatorMode.QR);
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
assetId | String | Yes | The ID of the specified asset. |
callback | IndustryDataCallBack | Yes | The callback. |
Example
// Get the asset activation token.
ActivatorService.activatorToken("assetId", new IndustryDataCallBack<String>() {
@Override
public void onSuccess(String s) {
Log.d(TAG, "onSuccess: " + s);
}
@Override
public void onFailure(@NonNull String s, @NonNull String s1) {
Log.d(TAG, "onFailure: " + s);
}
});
Parameters
Parameter | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
password | String | The password of the Wi-Fi network. |
token | String | The token obtained. |
Example
QRActivatorParams qrActivatorParams = new QRActivatorParams.Builder()
.setToken("token")
.setWifi("ssid","password")
.setTimeout(time)
.build();
qrActivator.setParams(qrActivatorParams);
IActivatorListener
to listen for pairing resultParameters
Parameter | Type | Required | Description |
---|---|---|---|
listener | IQRActivatorListener | Yes | The callback. |
Example
qrActivator.setListener(new IQRActivatorListener() {
@Override
public void onQRCodeSuccess(@NonNull String s) {
// You generate a QR code based on the return result.
Log.d(TAG, "onQRCodeSuccess: ");
}
@Override
public void onSuccess(@Nullable IDevice iDevice) {
Log.d(TAG, "onSuccess: ");
}
@Override
public void onError(@NonNull String s, @NonNull String s1) {
Log.d(TAG, "onError: ");
}
});
This method starts device pairing.
Example
qrActivator.start();
This method stops device pairing.
Example
qrActivator.stop();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback