Error when trying to log in to tuya iot with the android sdk

156 views Asked by At

I completed this tuya iot integration guide on android

https://developer.tuya.com/en/docs/app-development/tutorial-for-android-final?id=Kapicb0k79vrg

but I get this error

Business {"errorCode":"DECODE_ERROR","success":false,"status":"error","errorMsg":"DECODE_ERROR"} 2023-10-15 12:29:47.768 15683-15782 Tuya com...an.stark.innovations.ecohogar D Business api: tuya.p.time.get {"t":1697390987134,"success":false,"errorCode":"SING_VALIDATE_FALED","status":"error","errorMsg":"La validación del permiso falló"}

I already have the AppKey and AppSecret configured in my manifest.xml Also check the packageName and add sha 256.

The version of tuya smart that I use is:

implementation tuyasmart version: 'com.tuya.smart:tuyasmart:3.26.5'

What I can be doing wrong?

I have really tried to increase the version of tuya smart but the error persists. I would greatly appreciate your valuable help. First of all, Thanks

My code

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.INTERNET"/>




<application
    tools:node="merge"
    android:name=".ThingSmartApp"
    tools:replace="android:allowBackup, android:supportsRtl"
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.EcoHogar"
    android:networkSecurityConfig="@xml/network_security_config"
    tools:targetApi="31">

    <meta-data
        android:name="TUYA_SMART_APPKEY"
        android:value="*******" />
    <meta-data
        android:name="TUYA_SMART_SECRET"
        android:value="********" />

    <activity
        android:name=".userInterface.dashboard.DashboardActivity" >
    </activity>

    <activity
        android:name=".userInterface.MainActivity"
        android:exported="true"
        android:theme="@style/Theme.EcoHogar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
class ThingSmartApp : Application() {
override fun onCreate() {
    super.onCreate()
    TuyaHomeSdk.setDebugMode(true)
    TuyaHomeSdk.init(this);
}

}

class MainActivity : ComponentActivity() {
lateinit var contextData: Activity
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    contextData = this
    TuyaHomeSdk.getUserInstance().loginWithEmail("*", "***",
        "***", object : ILoginCallback {
            override fun onSuccess(user: User?) {
                Toast.makeText(contextData, "OK!!: ", Toast.LENGTH_SHORT)
                    .show()
            }

            override fun onError(code: String?, error: String?) {
                Toast.makeText(contextData, "code: $code  error!!: $error", Toast.LENGTH_SHORT)
                    .show()
            }

        })
}

}

build.gradle(:app)

// The latest version of the Tuya Home:
implementation 'com.tuya.smart:tuyasmart:3.13.0'
0

There are 0 answers