Last Updated on : 2022-02-17 06:14:00download
Process of Quick Connection Mode network configuration:
Before the Quick Connection Mode network configuration, SDK needs to obtain the network configuration Token from the Tuya Cloud. The term of validity of Token is 10 minutes, and Token becomes invalid once the network configuration succeeds. A new Token has to be obtained if you have to reconfigure the network.
Declaration
TuyaOSActivator.deviceActivator().getActivatorToken(final long homeId, final ITuyaActivatorGetToken activatorGetToken);
Parameters
Parameters | Description |
---|---|
homeId | Family ID, please refer to the family management section for details |
activatorGetToken | Distribution network Token get callback |
Example
TuyaOSActivator.deviceActivator().getActivatorToken(homeId,
new ITuyaActivatorGetToken() {
@Override
public void onSuccess(String token) {
}
@Override
public void onFailure(String s, String s1) {
}
});
Example
ActivatorBuilder builder = new ActivatorBuilder()
.setSsid(ssid)
.setContext(context)
.setPassword(password)
.setActivatorModel(ActivatorModelEnum.TY_EZ)
.setTimeOut(timeout)
.setToken(token)
.setListener(new ITuyaSmartActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
//If multiple devices are activated at the same time, they will be called back multiple times
}
@Override
public void onStep(String step, Object data) {
}
}
));
Parameters
Parameters | Description |
---|---|
token | Activation key required for Configuration |
context | context |
ssid | WiFi ssid |
password | WiFi password |
activatorModel | Configuration Mode, EZ Mode: ActivatorModelEnum.TY_EZ |
timeout | Configuration timeout, default setting is 100s, unit is second |
ITuyaActivator mTuyaActivator = TuyaOSActivator.deviceActivator().newMultiActivator(builder);
//Start configuration
mTuyaActivator.start();
//Stop configuration
mTuyaActivator.stop();
//Exit the page to destroy some cache data and monitoring data.
mTuyaActivator.onDestroy();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback