Skip to main content

Launching Photo Editor

Prerequisites

The license token IS REQUIRED to use Photo Editor SDK in your app.
Please check Requirements out guide if the license token is not set.

Initialize SDK

Create an instance of BanubaVideoEditor by using the license token

val editorSDK = BanubaVideoEditor.initialize(LICENSE_TOKEN)

editorSDK is null when the license token is incorrect i.e. empty, truncated. If editorSDK is not null you can proceed and start video editor.

tip

Share the same instance of BanubaVideoEditor for Photo Editor and Video Editor SDK.

Next, we strongly recommend checking your license state before staring video editor

photoEditorSDK.getLicenseState { isValid ->
if (isValid) {
// ✅ License is active, all good
// Start Photo Editor SDK
} else {
// ❌ Use of Photo Editor is restricted. License is revoked or expired.
}
}
danger

Photo editing content unavailable screen will appear if the user starts Photo Editor SDK with revoked or expired license.

Start editor

Import classes

import com.banuba.sdk.pe.PhotoCreationActivity
import com.banuba.sdk.pe.PhotoExportResultContract

Start Photo Editor SDK and handle exported results.
See example.


val photoEditorExportResult =
registerForActivityResult(PhotoExportResultContract()) { uri ->
// Handle exported image result
Log.d(TAG, "Image exported $uri")
}

// Start Photo Editor SDK
photoEditorExportResult.launch(PhotoCreationActivity.startFromGallery(this))