Initializing PSPDFKit

Apps using PSPDFKit need to initialize the framework before its first use. This can be done either automatically at application startup, or manually. Before initializing PSPDFKit, be sure to acquire a valid license key.

Automatic Initialization

The easiest way to initialize PSPDFKit is automatically during application startup. To use automatic initialization, add a <meta-data> element to your app’s AndroidManifest.xml. When present, PSPDFKit will initialize itself as soon as your app starts:

        android:value="YOUR_LICENSE_KEY_GOES_HERE" />

Manual Initialization

In some situations, you might want to initialize PSPDFKit manually at a later point (i.e. not during app startup). This can be done by omitting the <meta-data> element in your AndroidManifest.xml. When doing so, PSPDFKit won’t initialize itself at startup. Instead, use the PSPDFKit.initialize() method, providing your personal license key:

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

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