Skip to main content

Getting Started

Before You Begin#

This SDK is stored in the private maven repo and developed for use with the Cloudike Backend. If you need access, please Contacts Us

Requirements#

  • Minimum API level 21 or later


Installation#

To enable library in your app, you should add a link to our private repository in the application-level Gradle file (usually app / build.gradle). Then, add a dependency for the libraries photos and core as shown below and replace $LIBS_VERSION with the latest version of the library:

// ...repositories {      // ...     maven {        url "https://rt.cloudike.com/artifactory/libs-release-local"        credentials {            username = "${artifactory_username}"            password = "${artifactory_password}"        }    }}
// ...dependencies {    implementation "com.cloudike.sdk:core:$LIBS_VERSION"    implementation "com.cloudike.sdk:photos:$LIBS_VERSION"}

Initialization#

To initialize the library, you need an instance of the CoreManager class. To create it, use the build method of the CoreManager class. The build method takes the following parameters:

  1. context - application context (required parameter)
  2. logInterceptors - list of custom LogInterceptors required for logging within the library (optional parameter)

Example of CoreManager initialization:

val coreManager = CoreManager.build(context = applicationContext)

Next, you need to initialize the library by calling the build method and passing the necessary parameters, including the coreManager that was initialized earlier. It is best to initialize the library in the Application class. Other parameters:

  1. competitionMode - library operation mode(STANDALONE или INTEGRATION)
  2. competitorPackageName - package name of the application
  3. enablePeriodicScans - lag indicating the need to start periodic media file scanning
private lateinit var photoManager: PhotoManager
override fun onCreate() {    super.onCreate()    // ...
    photoManager = PhotoManager.build(        coreUtilities = coreManager,        competitionMode = CompetitionMode.STANDALONE,        competitorPackageName = "you_package_name",        enablePeriodicScans = true    )          // ...}

Notifications#

The library uses notifications to inform the user about the status of the media file scanning or uploading process. For this, you need to create your own implementations of the ScanNotificationProvider and UploadNotificationAdapter interfaces. Example implementation:

class ScanForeProvider : ScanNotificationProvider {
    override fun getNotification(): Notification {        val builder = NotificationCompat.Builder(context, YOUR_CHANNEL_ID)            .setCategory(Notification.CATEGORY_SERVICE)            .setSmallIcon(R.drawable.some_icon)            .setContentText("Scanning...")            .setContentTitle("Scanning media files")        return builder.build()    }
    override fun getNotificationId() = 12345}

After creating the implementation, you need to set it in the library:

    photoManager.timeline.setScanNotificationProvider(ScanForeProvider())

Dependencies#

Our SDK uses the following dependencies:

// Coroutinesimplementation(libs.kotlin.coroutines.core)implementation(libs.kotlin.coroutines.rx)
// RxJavaimplementation(libs.rx.java)implementation(libs.rx.kotlin)implementation(libs.rx.android)
// Daggerimplementation(libs.dagger)ksp(libs.dagger.compiler)
// Retrofit OkHttpimplementation(libs.retrofit.retrofit)implementation(libs.retrofit.rx)implementation(libs.retrofit.gson)implementation(libs.okhttp.okhttp)implementation(libs.okhttp.loggin.interceptor)
// Roomimplementation(libs.androidx.room.runtime)implementation(libs.androidx.room.rxjava2)implementation(libs.androidx.room.ktx)implementation(libs.androidx.room.paging)annotationProcessor(libs.androidx.room.compiler)ksp(libs.androidx.room.compiler)androidTestImplementation(libs.androidx.room.testing)
// Metadata Extractorimplementation(libs.drewnoakesMetadataExtractor)
// Pagingimplementation(libs.androidx.paging.runtime.ktx)implementation(libs.androidx.paging.rxjava2.ktx)
// Work managerimplementation(libs.androidx.work.runtime.ktx)implementation(libs.androidx.work.rxjava2)
// Another androidx componentsimplementation(libs.androidx.appcompat)implementation(libs.androidx.documentfile)implementation(libs.androidx.exifinterface)
// Datetime parsing and formatting (for minSdkVersion < 26)implementation(libs.threetenabp)
// TestingtestImplementation(libs.test.junit)testImplementation(libs.test.coroutines)testImplementation(libs.test.mockito)
androidTestImplementation(libs.test.androidExtJunit)androidTestImplementation(libs.test.androidEspressoCore)androidTestImplementation(libs.test.coroutines)androidTestImplementation(libs.test.mockito.android)