1
0
Fork 0
mirror of synced 2024-07-10 00:46:05 +12:00
appwrite/docs/examples/1.0.x/client-android/kotlin/storage/update-file.md
2022-09-14 17:41:36 +05:30

865 B

import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import io.appwrite.Client import io.appwrite.services.Storage

class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main)

    val client = Client(applicationContext)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID

    val storage = Storage(client)

    GlobalScope.launch {
        val response = storage.updateFile(
            bucketId = "[BUCKET_ID]",
            fileId = "[FILE_ID]",
        )
        val json = response.body?.string()        
    }
}

}