Register and Login with Anonymous Account

Last Updated on : 2023-03-09 08:17:40

Register and login with anonymous account

API description

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

Parameters

Parameter Type Description
countryCode String The country code. For example, 86 means China and 1 means the United States of America (USA).
nickName String The nickname used for anonymous login. For example, a device name can be used.
callback IRegisterCallback The callback.

Example

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

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

    }
});

Bind anonymous account with contact information

API description

Adds a mobile phone number or email address to an anonymous account to change it into a normal account. Perform the following steps:

  1. Verify an email address or mobile phone number.
  2. Reset the password of the account.
void touristBindWithUserName(String countryCode, String userName, String verifyCode, String password, final IBooleanCallback callback)

Parameters

Parameter Type Description
countryCode String The country code. For example, 86 means China and 1 means the United States of America (USA).
userName String The mobile phone number or email address to be bound with the account.
verifyCode String The verification code.
password String The password to be reset.
callback IBooleanCallback The callback.

Example

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

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

    }
});