This document is deprecated, please go to Tuya Developer Documentation Center to view the latest version: Tuya Smart Doc - Android SDK

1. Anonymous Registration

1.1. Anonymous Registration

Declaration

SDK provides anonymous registration to log in, passing parameters: nickName, anonymous login nickname; countryCode, country code.

void touristRegisterAndLogin(String countryCode, String nickName, final IRegisterCallback callback)

Parameters

Params Type Description
countryCode String Country code, 86: China, 1: USA
nickName String Nickname of anonymous login (for example: device name)
callback IRegisterCallback Callback

Example

TuyaHomeSdk.getUserInstance().touristRegisterAndLogin(countryCode, nickName, new IRegisterCallback() {
    @Override
    public void onSuccess(User user) {

    }
    @Override
    public void onError(String code, String error) {

    }
});

1.2. Anonymous User Logout

Declaration

Users who log in anonymously can log out through this interface. Anonymous accounts will be logged out immediately.

void touristLogOut(final ILogoutCallback callback)

Parameters

Params Type Description
success ILogoutCallback Callback

Example

TuyaHomeSdk.getUserInstance().touristLogOut(new ILogoutCallback() {
    @Override
    public void onSuccess() {

    }
    @Override
    public void onError(String code, String error) {

    }
});

1.3. Anonymous User Bind Account

Declaration

Users who log in anonymously can further improve their mobile phone or email information and transform them into normal users. There are usually two steps to perfecting information:

  • Verify email or mobile phone

  • Set account password

void touristBindWithUserName(String countryCode, String userName, String verifyCode, String password, final IBooleanCallback callback)

Parameters

Params Type Description
countryCode String Country code(For example: 1, USA; 86, China)
userName String User's phone number or email
vefifyCode String Verification code
password String Password
callback IBooleanCallback Callback

实例代码

TuyaHomeSdk.getUserInstance().touristBindWithUserName(countryCode, userName, code, password, new IBooleanCallback() {
    @Override
    public void onSuccess() {

    }
    @Override
    public void onError(String code, String error) {

    }
});

results matching ""

    No results matching ""