Nutrient 6.1 migration guide

This article provides a set of guidelines for migrating from Nutrient Android SDK 6.0 to PSPDFKit Android SDK 6.1.

Updated build versions

With Nutrient 6.1, we updated various build properties and versions:

  • The targetSdkVersion of all examples was updated to 29.

  • Updated transitive dependency versions:

    • androidx.appcompat:appcompat was updated to version 1.1.0.

    • com.squareup.okhttp3:okhttp was updated to 4.2.1.

Deprecations

Here’s a list of fields and methods that have been deprecated:

  • DocumentSharingIntentHelper#createChooser() was deprecated. This method takes a pre-fetched list of explicit share targets. While showing an intent chooser using explicit share targets works on all Android versions up to API 28, starting with Android 10 (API 29) the system will truncate the list of explicit share targets, breaking this methods behavior.

    Any use of this method should be migrated to the Android framework’s Intent#createChooser() method, which takes an implicit intent for targeting share targets.

    Instead of this:

    final List<Intent> explicitShareIntents = DocumentSharingIntentHelper.getShareIntents(context, shareUri, shareAction);
    final Intent chooserIntent = DocumentSharingIntentHelper.createChooser(explicitShareIntents, null);
    context.startActivity(chooserIntent);

    Do this:

    final Intent implicitShareIntent = DocumentSharingIntentHelper.getShareIntent(context, shareUri, shareAction);
    final Intent chooserIntent = Intent.createChooser(implicitShareIntent, null);
    context.startActivity(chooserIntent);
  • DocumentSharingIntentHelper#queryMailToActivities() was deprecated. Use DocumentSharingIntentHelper#queryIntentActivities() with an intent that has the Intent#ACTION_SENDTO action and mailto: Uri.

  • DefaultEmbeddedFileSharingController was deprecated. Use DefaultDocumentSharingController instead which provides the same functionality.

Private API warnings

Nutrient 6.1 added a linter check that warns developers when using Nutrient’s private APIs, i.e. classes, methods or fields which are parts of the com.pspdfkit.framework Java package. Usage of private APIs is unsupported and will break starting with Nutrient Android SDK 6.2 in early 2020.

If you are receiving linter warnings about private API usage after updating to 6.1, or if you are not sure whether your app is using private APIs, reach out to our customer support team or via mail to [email protected].

For more information on private API usage, see our online guide about unsupported private symbols.