Nutrient 2024.8 migration guide

This guide outlines the changes to Nutrient Android SDK 2024.8.

API changes

Breaking data class changes

PdfConfiguration and PdfActivityConfiguration have been replaced with Kotlin data classes. This means some of the APIs have changed slightly.

If you’re writing in Java, you might need to add configuration.getThing() syntax instead of configuration.thing(). For example:

// Before, to get the starting page:
configuration.page();

// After
configuration.getPage();

If you’re writing in Kotlin, you need to use the property access syntax. For example:

// Before
configuration.getPage()

// After
configuration.page

In Java, if you’re using InstantPdfActivityIntentBuilder, you need to use the Companion object to call fromInstantDocument:

// Before
final Intent intent = InstantPdfActivityIntentBuilder.fromInstantDocument(

// After
final Intent intent = InstantPdfActivityIntentBuilder.Companion.fromInstantDocument(

Note that we’re still using the Builder pattern here to reduce the amount of breaking changes we create for customers. Ideally, this would be a pure data class with defaults set in the constructor. This change may come in a future release.

Breaking SearchType

The Int constants PdfActivityConfiguration.SEARCH_INLINE and PdfActivityConfiguration.SEARCH_MODULAR have been replaced by an enum, SearchType. You’ll need to update your code if you’re using these — for example:

// Before
val searchType: Integer = if (inlineSearch) PdfActivityConfiguration.SEARCH_INLINE else PdfActivityConfiguration.SEARCH_MODULAR

// After
val searchType: SearchType = if (inlineSearch) SearchType.INLINE else SearchType.MODULAR
)
// Before
final int searchType = inlineSearch ? PdfActivityConfiguration.SEARCH_INLINE : PdfActivityConfiguration.SEARCH_MODULAR;

// After
final SearchType searchType = inlineSearch ? SearchType.INLINE : SearchType.MODULAR;

SignatureAppearance option removed

The PdfConfiguration option to set SignatureAppearance has been removed, as it isn’t used internally. To set SignatureAppearance, use DigitalSignatureMetadata, which can be passed to SignerOptions.

Builder classes removed

SignatureAppearance

SignatureAppearance has changed to a Kotlin data class, and its Builder has been removed. SignatureGraphic has been taken out of the SignatureAppearance class into its own file.

Here’s an example of configuring the signature appearance before and after this release:

// Before
val signatureAppearance = SignatureAppearance.Builder()
    .setShowWatermark(false)
    .setShowSignDate(false)
    .setSignatureGraphic(SignatureAppearance.SignatureGraphic.fromBitmap(logo))
    .build()
// After
val signatureAppearance = SignatureAppearance(
    showWatermark = false,
    showSignDate = false,
    signatureGraphic = SignatureGraphic.fromBitmap(logo)
)

SearchConfiguration

SearchConfiguration has changed to a Kotlin data class, and its Builder has been removed. Instead, you can construct a custom configuration using its properties:

// Default SearchConfiguration with a custom `snippetLength`
val config = SearchConfiguration(snippetLength = 123)

BiometricSignatureData

BiometricSignatureData has changed to a Kotlin data class, and its Builder has been removed. Instead, you must construct it using its constructor.

Deprecations

We replaced the separate enable|disableX() functions in the Builder classes for PdfConfiguration and PdfActivityConfiguration with a single xEnabled(boolean) function. Update your use of these before we remove the deprecations in 2025. For example:

// Before
configuration.enableAnnotationRotation()
configuration.disableFormEditing()

// After
configuration.annotationRotationEnabled(true)
configuration.formEditingEnabled(false)
)
// Before
configuration.enableAnnotationRotation();
configuration.disableFormEditing();

// After
configuration.annotationRotationEnabled(true);
configuration.formEditingEnabled(false);
)