Package-level declarations

Photo face manager.

Face Manager allows you to retrieve faces from photos uploaded to the cloud, as well as associated albums and photos.

Getting faces for photography.

import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.photos.faces.FacesManager
import kotlinx.coroutines.CoroutineScope

val scope = CoroutineScope()

// You can use PhotoManager.familyFacesManager to work with family cloud
val facesManager: FacesManager = PhotoManager.facesManager
val photoId: Long = 0

scope.launch {

// Getting faces for photography by photo id.
facesManager.fetchPhotoFaces(photoId)
}

Exceptions:

  • SessionIsNotInitializedException Session is not active.

  • UnauthorizedException Unauthorized access.

  • ForbiddenAccessException Forbidden access.

  • IllegalArgumentException Photo with id photoId is not found in the database.

  • IOException Other problems.

Example of a log for the operation of getting faces from a photograph.

FetchPhotoFaces : [Ph] Start operation.

To get a list of faces use the following code example.

import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.photos.faces.FacesManager
import kotlinx.coroutines.CoroutineScope

val scope = CoroutineScope()

// You can use PhotoManager.familyFacesManager to work with family cloud
val facesManager: FacesManager = PhotoManager.facesManager

scope.launch {

// Getting flow of faces for photography by photo id from database.
facesManager.createPhotoFacesFlow(photoId).collect { faces -> // faces: List<FaceItem>
// do something...
}
}

Getting photos for the face.

import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.photos.faces.FacesManager
import kotlinx.coroutines.CoroutineScope

val scope = CoroutineScope()

// You can use PhotoManager.familyFacesManager to work with family cloud
val facesManager: FacesManager = PhotoManager.facesManager
val faceId: String = ""

scope.launch {

// Getting faces for photography by photo id.
facesManager.fetchFacePhotos(faceId)
}

scope.launch {

// Getting flow of photos for face by face id from database.
facesManager.createFacePhotosPagingFlow(faceId).collect { photos -> // photos: PagingData<PhotoItem>
// do something...
}
}

Exceptions:

  • SessionIsNotInitializedException Session is not active.

  • UnauthorizedException Unauthorized access.

  • ForbiddenAccessException Forbidden access.

  • IllegalArgumentException Face with id faceId is not found in the database.

  • IOException Other problems.

Example of a log for the operation of getting faces from a photograph.

FetchPhotoFaces : [Ph] Start operation.

To get a list of face photos, use the following code example.

import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.photos.faces.FacesManager
import kotlinx.coroutines.CoroutineScope

val scope = CoroutineScope()

// You can use PhotoManager.familyFacesManager to work with family cloud
val facesManager: FacesManager = PhotoManager.facesManager
val faceId: String = ""

scope.launch {

// Getting flow of photos for face by face id from database.
facesManager.createFacePhotosPagingFlow(faceId).collect { photos -> // photos: PagingData<PhotoItem>
// do something...
}
}

Getting a face album.

import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.photos.faces.FacesManager
import kotlinx.coroutines.CoroutineScope

val scope = CoroutineScope()

// You can use PhotoManager.familyFacesManager to work with family cloud
val facesManager: FacesManager = PhotoManager.facesManager
val faceId: String = ""

scope.launch {

// Getting faces for photography by photo id.
facesManager.fetchFaceAlbum(faceId)
}

scope.launch {

// Getting flow of album for face by face id from database.
facesManager.createFaceAlbumFlow(faceId).collect { album -> // album: Album?
// do something...
}
}

Exceptions:

  • SessionIsNotInitializedException Session is not active.

  • UnauthorizedException Unauthorized access.

  • ForbiddenAccessException Forbidden access.

  • IllegalArgumentException Face with id faceId is not found in the database.

  • FaceAlbumIsNotExistsException Face album is not yet exists on the backend!

  • IOException Other problems.

Example of a log for the operation of getting faces from a photograph.

FetchPhotoFaces : [Ph] Start operation.

To get a personalized face album, use the following sample code.

import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.photos.faces.FacesManager
import kotlinx.coroutines.CoroutineScope

val scope = CoroutineScope()

// You can use PhotoManager.familyFacesManager to work with family cloud
val facesManager: FacesManager = PhotoManager.facesManager
val faceId: String = ""

scope.launch {

// Getting flow of album for face by face id from database.
facesManager.createFaceAlbumFlow(faceId).collect { album -> // album: Album?
// do something...
}
}

Types

Link copied to clipboard
data class FaceItem(val id: String, val description: String, val coordinates: List<Int>, val vector: List<Float>?, val linkSelf: String, val linkFindFaces: String, val linkAlbum: String?) : Parcelable
Link copied to clipboard
interface FacesManager

Photo face manager.