Home > Mobile >  How to display images from Google Cloud Storage that start with gs:// in Jetpack Compose?
How to display images from Google Cloud Storage that start with gs:// in Jetpack Compose?

Time:08-19

I'm using Kotlin and Jetpack Compose, and I want to display some images that exist in Google Cloud Storage. The reference that I get is not an URL but a reference that starts with gs://. Here is what I have tried using Coil:

AsyncImage(
    modifier = Modifier.width(64.dp).height(64.dp),
    model = ImageRequest.Builder(LocalContext.current)
        .data(url) // gs://...
        .build(),
    contentDescription = null
)

But I get:

Unable to fetch data.

How to overcome this situation?

CodePudding user response:

You would need to use the Firebase Cloud Storage SDK to access the storage bucket, and then use the this documentation to download the actual images.

  • Related