Easily add a license key to your Android app

Nutrient is a commercial product and uses a license key to verify your copy against the package name you registered.

Alternatively, you can initialize the SDK in trial mode without a license.

Generating the license key

To use a Nutrient license with your app, you have to generate a license key and bind it to the applicationId bundle ID of your app.

  1. Log in to the [Nutrient Portal][] using the credentials you received when purchasing Nutrient. You’ll see the list of all your purchased licenses.

  2. Locate your license (e.g. Nutrient Android SDK) and click the Assign license key button next to it. A dialog will open.

  3. Enter the bundle ID of your production app. If you’re unsure about this step, read our What Is a Bundle ID? guide first.

  4. Click next and confirm your selected bundle ID. Double-check that the chosen identifier matches the one configured in your app, as it can no longer be changed once it’s been set.

Getting the license key

  1. Log in to the [Nutrient Portal][] using the credentials you received when purchasing Nutrient. You’ll see the list of all your purchased licenses.

  2. Locate your license (e.g. Nutrient Android SDK) and click the License Key button next to it. If there’s no such button, you probably need to generate the license key first.

  3. A dialog will open showing you a code snippet with your license key.

  4. After copying the license key over to your project, the Nutrient SDK will be ready to use.

Adding the license key

This can be done either through editing your AndroidManifest, or calling the PSPDFKit.initialize method manually. Calling PSPDFKit.initialize without passing in a key will initialize the SDK in trial mode.

For the first option, you must add the following <meta-data> element to your application’s AndroidManifest.xml:

<application>
    <meta-data
        android:name="pspdfkit_license_key"
        android:value="YOUR_LICENSE_KEY_GOES_HERE" />
</application>

When this snippet is present, Nutrient will initialize itself as soon as your app starts.

In some situations, you might want to initialize the SDK manually at a later point (i.e. not during app startup). This can be done by using the PSPDFKit.initialize method and providing it with your license key:

PSPDFKit.initialize(context, "YOUR_LICENSE_KEY_GOES_HERE")
PSPDFKit.initialize(context, "YOUR_LICENSE_KEY_GOES_HERE");

More initialize options can be passed using [InitializationOptions][], instead of using only a license key string to PSPDFKit.initialize.

Since initialization can take some time (due to extraction and loading of Nutrient’s native libraries), make sure to initialize Nutrient on a background thread, in order to not block your UI.

Trial mode

For the trial experience, you can initialize the SDK with a null license:

PSPDFKit.initialize(context, null)
PSPDFKit.initialize(context, null);

More information on trying out PSPDFKit for Android can be found on our trial page.