1. Modify User Infomation

1.1. Change Nickname

Declaration

Change nickname

void reRickName (String name, final IReNickNameCallback callback);

Parameters

Parameters Description
name Nickname
callback callback

Example

TuyaHomeSdk.getUserInstance().reRickName (nickName,
    new IReNickNameCallback () {
        @Override
        public void onSuccess () {
        }
        @Override
        public void onError (String code, String error) {

        }
});

1.2. Update User Time Zone

Declaration

Used to update the user time zone.

void updateTimeZone(String timezoneId, IResultCallback callback);

Parameters

Parameters Description
timezoneId timezone id
callback callback

Example

TuyaHomeSdk.getUserInstance().updateTimeZone (
    timezoneId,
    new IResultCallback () {
        @Override
        public void onSuccess () {
        }

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

        }
});

1.3. Upload User Avatar

Declaration

Used to upload user-defined avatars.

void uploadUserAvatar(File file, IBooleanCallback callback)

Parameters

Parameters Description
file User avatar image file
callback callback

Code Example

TuyaHomeSdk.getUserInstance().uploadUserAvatar (
    file,
    new IBooleanCallback () {
        @Override
        public void onSuccess () {
        }

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

        }
});

1.4. Set the Temperature Unit

Declaration

Set whether the temperature unit is Celsius or Fahrenheit

  • TempUnitEnum.Celsius: Celsius
  • TempUnitEnum.Fahrenheit: Hua degree
void setTempUnit (TempUnitEnum unit, IResultCallback callback);
Parameters Description
unit unit
callback callback

1.5. Update User Targeting

If necessary, the positioning information can be reported through the following interfaces:

TuyaSdk.setLatAndLong (lat, lon);

1.6. Synchronize User information

When the user information changes, such as modifying the user's avatar, nickname, etc., you need to call the synchronous user information interface to keep the user information up to date. If multiple devices log in at the same time, one device modifies the user information. Another device also needs to synchronize user information. You can call the synchronization interface when viewing user information to synchronize the latest user information.

Description

Used to synchronize user information

void updateUserInfo(IResultCallback callback);

Parameters

Parameters Description
callback callback

Example

TuyaHomeSdk.getUserInstance().updateUserInfo(new IResultCallback() {
    @Override
    public void onError(String code, String error) {

    }

    @Override
    public void onSuccess() {
        User user = TuyaHomeSdk.getUserInstance().getUser();
    }
});

results matching ""

    No results matching ""