Skip to main content

Photos SDK

SDK for working with Cloudike photos and albums — gallery, albums, cover images.

Applies to Photos SDK 5.5.2+

Installation

Declare Cloudike's private Maven repository in your project's settings.gradle.kts (artifactory_username/artifactory_password are credentials provided by Cloudike, set in your own gradle.properties):

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://rt.cloudike.com/artifactory/libs-release-local")
credentials {
username = settings.extra.properties["artifactory_username"].toString()
password = settings.extra.properties["artifactory_password"].toString()
}
}
}
}

Add photos and its required core dependency to your app module's build.gradle.kts and sync the project:

dependencies {
implementation("com.cloudike.sdk:photos:<version>")
implementation("com.cloudike.sdk:core:<version>")
}

Initialization

import com.cloudike.sdk.core.CoreManager
import com.cloudike.sdk.core.competition.CompetitionMode
import com.cloudike.sdk.photos.PhotoManager
import kotlinx.coroutines.runBlocking

val coreContext = CoreManager.build(applicationContext)

runBlocking {
coreContext.sessionManager.start(
reset = false,
baseUrl = "https://your-backend.example.com/", // your Cloudike backend endpoint
accessToken = accessToken, // from your sign-in flow
userId = userId, // from your sign-in flow
userAgent = "YourApp/1.0",
)
}

val photoManager = PhotoManager.build(
coreContext = coreContext,
competitionMode = CompetitionMode.INTEGRATION,
competitorPackageName = "com.example.yourapp", // your own app's package name
)

Builds the shared CoreContext, starts the user session on it, then builds PhotoManager on the same CoreContext. CompetitionMode.INTEGRATION marks Photos SDK as embedded in your own app rather than running standalone. baseUrl/accessToken/userId/userAgent come from your own sign-in flow — the values shown are placeholders.

First API Call

import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking

val mediaItems = runBlocking {
photoManager.timeline.createFlow(userId = userId).first()
}
println("Timeline items: ${mediaItems.size}")

Reads the user's photo and video gallery as a Flow and takes its first emission. Prints the number of items found — 0 until the first sync, growing as photos are uploaded or downloaded — confirming Photos SDK can read the account's data.