Skip to main content
PESDK/Android/Getting Started

Migration from v9

Migration guide for PhotoEditor SDK v9.

1. Update the Plugin to v10#

Update the plugin version to the latest version. Make sure to include the IMG.LY Maven repository if you haven't already.

2. Dropping Jelly Bean and KitKat support#

PhotoEditor SDK v10 removed support for running on Android Jelly Bean and KitKat (API 16 - 20) devices. The new minimum supported Android version is 5.0 Lollipop (API 21).

Update your project's minSdkVersion to at-least 21 to use PhotoEditor SDK v10.

3. compileSdkVersion & buildToolsVersion Update#

We have updated the SDK's compileSdkVersion to 31 and buildToolsVersion to 31.0.0. We would recommend you to use the same versions or higher in your project.

4. AppCompat Migration#

PhotoEditorActivity and CameraPreviewActivity now extends from AppCompatActivity.

If you were previously using your own Activity with our Editor, make sure to extend from AppCompatActivity.

5. Changes to Themes#

All our themes now extend from Theme.AppCompat.

We have also renamed all our themes to follow a consistent naming scheme. Our default theme PESDKMobileUIDefaultTheme has been renamed to Theme.Imgly. All other themes starting with Imgly.Theme have been renamed to start with Theme.Imgly.

6. Dropping Kotlin 1.4 support#

PhotoEditor SDK v10 now uses Kotlin version 1.5.32 and does not support Kotlin version 1.4 anymore. Consider updating your project's Kotlin version to at-least 1.5.32.

7. Changed SettingsList constructor for permission handling#

Due to security changes in the Android platform, we have to work around Uri permission handling. Thus, you must decide if the read permission of the Uri references in the SettingsList needs to be retained after the Editor is closed.

Check if you need to access the Uris in the SettingsList returned by the Editor, in your Activity's result. This is true, for example, if you wish to use IMGLYFileWriter or DocumentRenderWorker. To enable this, pass true in the constructor of the PhotoEditorSettingsList. The Editor will then copy all Uris with read permission, in a background thread to the app's temporary directory.

If you do not need this feature, for example, because you do not access the SettingsList returned by the Editor, pass false in the constructor of the PhotoEditorSettingsList.

8. SettingsList must be released#

The SettingsList needs to be released by the creator, after passing it to one or more consumers. If the consumer needs to hold a reference to the SettingsList, the consumer should store a parcel-ed version of the SettingsList.

Example Code 1. Handle SDK start.

// Create a SettingsList
// -> You are the creator, you have to release it later!
val settingsList = PhotoEditorSettingsList(true)
// Pass it to the PhotoEditorBuilder, which consumes the settingsList by creating a copy of it.
PhotoEditorBuilder(this@MainActivity)
.setSettingsList(settingsList)
.startActivityForResult(this@MainActivity, EDITOR_ACTIVITY_RESULT)
// Because you are the creator, you now have to release the SettingsList.
settingsList.release()

Example Code 2. Handle SDK result.

// Create a wrapped editor intent result.
val editorResult = EditorSDKResult(intent)
// With accessing the SettingsList, the SettingList is created from the Intent.
// -> You are the creator, you have to release it later!
val settingList = editorResult.settingsList
// You can use this SettingsList, to write a Serialization (IMGLYFileWriter is the consumer).
// But because all IMGLYFileWriter write methods are synchronous calls, IMGLYFileWriter does not create a copy of the SettingsList! (Holding a reference to the IMGLYFileWriter for later use, after SettingsList is released will not work)
IMGLYFileWriter(settingsList).writeJson(myFile)
// You can also use the same SettingsList with the DocumentRenderWorker to start a background export.
// Because DocumentRenderWorker is asynchronous, the `DocumentRenderWorker.createWorker(settingList)` call creates a copy of the SettingsList.
WorkManager.getInstance(this).enqueue(DocumentRenderWorker.createWorker(settingsList))
// Because you are still the creator, you now have to release your instance of the SettingsList.
// (DocumentRenderWorker will do the same with its version of the SettingsList internally)
settingsList.release()

If you forget to release the SettingList, the Editor will log an error in the console with some delay.

9. Nullability Changes#

The signature of the following functions/constructors have been changed to correctly reflect the nullability of their parameters -

  • ImglyIntent::startActivityForBroadcast()
  • PhotoEditorBuilder::startActivityForBroadcast()
  • EditorBuilder and its subclasses' constructors.

10. Deprecations#

  • RoxOperation::onReleaseOperator() renamed to RoxOperation::onOperatorReleased().
  • PhotoEditorBuilder::startActivityForBroadcast() is now obsolete. We replaced it with WorkManager Worker created with DocumentRenderWorker.createWorker(settingsList).