1
0
Fork 0
mirror of synced 2024-07-25 00:06:24 +12:00
appwrite/docs/examples/1.0.x/client-android/kotlin/storage/update-file.md

27 lines
865 B
Markdown
Raw Normal View History

2022-09-01 16:49:47 +12:00
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()
}
}
}