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:
SessionIsNotInitializedExceptionSession is not active.UnauthorizedExceptionUnauthorized access.ForbiddenAccessExceptionForbidden access.IllegalArgumentExceptionPhoto with id photoId is not found in the database.IOExceptionOther 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:
SessionIsNotInitializedExceptionSession is not active.UnauthorizedExceptionUnauthorized access.ForbiddenAccessExceptionForbidden access.IllegalArgumentExceptionFace with id faceId is not found in the database.IOException Otherproblems.
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:
SessionIsNotInitializedExceptionSession is not active.UnauthorizedExceptionUnauthorized access.ForbiddenAccessExceptionForbidden access.IllegalArgumentExceptionFace with id faceId is not found in the database.FaceAlbumIsNotExistsExceptionFace album is not yet exists on the backend!IOExceptionOther 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...
}
}