To use the Cloud Storage Android SDK with Kotlin Extensions, add the following
to your app's build.gradle file:
// See maven.google.com for the latest versions
// This library transitively includes the firebase-storage library
implementation 'com.google.firebase:firebase-storage-ktx:$VERSION'Kotlin
val storage = FirebaseStorage.getInstance()
val anotherStorage = FirebaseStorage.getInstance(FirebaseApp.getInstance("myApp"))Kotlin + KTX
val storage = Firebase.storage
val anotherStorage = Firebase.storage(Firebase.app("myApp"))Kotlin
val storage = FirebaseStorage.getInstance("gs://my-custom-bucket")
val anotherStorage = FirebaseStorage.getInstance(FirebaseApp.getInstance("myApp"), "gs://my-custom-bucket")Kotlin + KTX
val storage = Firebase.storage("gs://my-custom-bucket")
val anotherStorage = Firebase.storage(Firebase.app("myApp"), "gs://my-custom-bucket")Kotlin
val metadata = StorageMetadata.Builder()
.setContentType("image/jpg")
.setContentDisposition("attachment")
.setCustomMetadata("location", "Maputo, MOZ")
.build()Kotlin + KTX
val metadata = storageMetadata {
contentType = "image/jpg"
contentDisposition = "attachment"
setCustomMetadata("location", "Maputo, MOZ")
}