I'm trying to use the Appwrite SDK for Android to update a user's password in my Kotlin app. I'm using the following code, but the update doesn't seem to be happening:
binding.updatePasswordBtn.setOnClickListener {
GlobalScope.launch(Dispatchers.Main) {
try {
val response = account.updatePassword(binding.password.text.toString())
startActivity(Intent(this@UpdatePasswordActivity, LoginActivity::class.java))
finish()
} catch (e: AppwriteException) {
Toast.makeText(this@UpdatePasswordActivity,e.message.toString(),Toast.LENGTH_SHORT).show()
}
}
}
account
comes from the following object:
object AppwriteManager {
lateinit var client: Client
lateinit var account: Account
fun initialize(context: Context) {
client = Client(context)
.setEndpoint("https://cloud.appwrite.io/v1")
.setProject("648b14**************")
.setSelfSigned(status = true)
account = Account(client)
}
}
I've added the following dependency to my code:
implementation("io.appwrite:sdk-for-android:2.0.0")
Any idea what I'm doing wrong?