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();
// Afterconfiguration.getPage();
If you’re writing in Kotlin, you need to use the property access(opens in a new tab) syntax. For example:
// Beforeconfiguration.getPage()
// Afterconfiguration.page
In Java, if you’re using InstantPdfActivityIntentBuilder
, you need to use the Companion
object to call fromInstantDocument
:
// Beforefinal Intent intent = InstantPdfActivityIntentBuilder.fromInstantDocument(
// Afterfinal 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:
// Beforeval searchType: Integer = if (inlineSearch) PdfActivityConfiguration.SEARCH_INLINE else PdfActivityConfiguration.SEARCH_MODULAR
// Afterval searchType: SearchType = if (inlineSearch) SearchType.INLINE else SearchType.MODULAR)
// Beforefinal int searchType = inlineSearch ? PdfActivityConfiguration.SEARCH_INLINE : PdfActivityConfiguration.SEARCH_MODULAR;
// Afterfinal 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:
// Beforeval signatureAppearance = SignatureAppearance.Builder() .setShowWatermark(false) .setShowSignDate(false) .setSignatureGraphic(SignatureAppearance.SignatureGraphic.fromBitmap(logo)) .build()// Afterval 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:
// Beforeconfiguration.enableAnnotationRotation()configuration.disableFormEditing()
// Afterconfiguration.annotationRotationEnabled(true)configuration.formEditingEnabled(false))
// Beforeconfiguration.enableAnnotationRotation();configuration.disableFormEditing();
// Afterconfiguration.annotationRotationEnabled(true);configuration.formEditingEnabled(false);)