Basil
Basil

Reputation: 69

android firebase (not calling breakpoints)

Trying to read file from firebase like

fun download() {
     val storage : FirebaseStorage = Firebase.storage("gs://link")
     val storageRef : StorageReference = storage.reference

     val pathReference = storageRef.child("file.csv")

     val size: Long = 1024 * 1024

     val getBytesTask : Task<ByteArray> = pathReference.getBytes(size)
     getBytesTask.addOnSuccessListener {
         it.toString()
         Timber.d("1")
     }.addOnFailureListener {
         it
         Timber.d("2")
     }.addOnCompleteListener {
         Timber.d("3")
     }.addOnCanceledListener {
         Timber.d("4")
     }
}

Strange:no callbacks from firebase has being called

Upvotes: 0

Views: 51

Answers (1)

Dmitry Kuleshov
Dmitry Kuleshov

Reputation: 601

You need to specify the storage link directly if you want to download or upload files from custom, not default repository. If the file is located in the default repository skip this declaration and use the default initializer. Try this:

val storage : FirebaseStorage = Firebase.storage
val storageRef : StorageReference = storage.reference
val pathReference = storageRef.child("file.csv")

Upvotes: 1

Related Questions