1. Use Uid for Login

1.1. User Uid Registration and Login


If had registered, then automatically logged in. If had not registered, then automatically registered and logged in.

TuyaHomeSdk.getUserInstance().loginOrRegisterWithUid(String countryCode, String uid, String passwd, ILoginCallback callback);


Parameters Description
countryCode country code, for example: 86
uid uid
passwd User Password
callback callback


// uid login
TuyaHomeSdk.getUserInstance().loginOrRegisterWithUid("86", "1234", "123456", new ILoginCallback () {
    public void onSuccess (User user) {
        Toast.makeText (mContext, "Successfully logged in, username:", Toast.LENGTH_SHORT) .show ();

    public void onError (String code, String error) {
        Toast.makeText (mContext, "code:" + code + "error:" + error, Toast.LENGTH_SHORT) .show ();

results matching ""

    No results matching ""