Documentation

Add GIFs to your Android app

A Kotlin client and a Jetpack Compose picker with search, trending results, stickers and animated playback.

1. Add the repository and dependency

Add GifSnap’s Maven repository to your existing repository list in settings.gradle.kts, then add the Compose dependency to your app module. The picker includes the client transitively.

settings.gradle.kts
// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://gifsnap.com/sdk/android")
    }
}
app/build.gradle.kts
// app/build.gradle.kts
dependencies {
    implementation("com.rowix.gifsnap:gifsnap-compose:0.1.1")
}

The Compose picker requires Android 9 / API 28 or later. The client alone supports Android 6 / API 23 or later. Use compileSdk 36 or later, Kotlin 2.2.10 or later, and Java target 17. These artifacts are hosted by GifSnap, not Maven Central.

2. Show the picker

Call the picker from your Compose content. Keep the client with remember, then use onSelect to attach the selected GIF to your app’s composer.

Inside your @Composable
import androidx.compose.runtime.remember
import com.rowix.gifsnap.client.GifSnapClient
import com.rowix.gifsnap.compose.GifSnapPicker

// Inside your @Composable content:
val client = remember { GifSnapClient() }
GifSnapPicker(
    client = client,
    onSelect = { gif -> println(gif.url) }
)

3. Match your app

Browse stickers
import com.rowix.gifsnap.client.MediaType
import com.rowix.gifsnap.compose.GifSnapTheme

GifSnapPicker(
    client = client,
    theme = GifSnapTheme.System,
    initialMediaType = MediaType.Stickers,
    onSelect = { gif -> println(gif.url) }
)

The system theme follows the device. The selection returns a GifItem with the full media URL, title, dimensions and source metadata. Preserve these fields together when sending or storing a selection.

Use the Kotlin client on its own

If you already have a picker UI, depend on com.rowix.gifsnap:gifsnap-client:0.1.1 instead. Its suspend functions support coroutine cancellation.

Kotlin client
import com.rowix.gifsnap.client.GifSnapClient
import com.rowix.gifsnap.client.MediaType

val client = GifSnapClient()
// Call from a coroutine, such as viewModelScope.launch.
val result = client.search(
    "hello",
    mediaType = MediaType.Gifs,
    page = 1,
    limit = 12
)
val gifs = result.data

Playback and pagination

The picker includes Coil’s animated image decoder for GIF and animated WebP on API 28 and later. It requests full media before falling back to a preview, which can be static. A custom UI should also use an animation-capable decoder.

Keep the same query and page size while paging. Follow the returned pagination metadata rather than deriving the next page from the number of visible cards: verified duplicates can be removed from the UI without changing the server’s page boundaries.

No API key is required today. The SDK is MIT licensed; returned media retains its own rights and source metadata. See the repository for exact build requirements and dependency versions.

Source, releases and full Android reference ↗ · Shared API reference