With Instant, it’s easier than ever to add real-time collaboration features to your Nutrient-powered app, allowing your users to seamlessly share, edit, and annotate PDF documents across Android, iOS, and Web apps. This article will guide you through integrating Instant into your own apps.

Requirements

  • Nutrient Android SDK with Instant

Nutrient and Instant are two separate Android libraries available in the same download. Download the latest release from my.nutrient.io(opens in a new tab), or, for evaluation purposes, check out our free trial.

  • A Document Engine Instance

See the example projects guide to get an instance up and running.

Quick start with the example project

The Catalog app(opens in a new tab) includes an Instant example that connects to our example server apps and demonstrates real-time collaboration.

Setting up Document Engine

  1. Follow the example projects guide to set up Document Engine with one of our example server projects. This will start Document Engine on port 5000 and the web example on port 3000.
  2. Open http://localhost:3000 in a browser, enter a username when prompted, and upload a PDF using the Upload PDF button.

Connecting from the Android Catalog app

  1. Clone and open the Catalog app(opens in a new tab) in Android Studio.
  2. Run adb reverse tcp:5000 tcp:5000 && adb reverse tcp:3000 tcp:3000 to forward emulator/device ports to host ports.
  3. Run the Instant example from the Catalog app (located at app/src/main/java/com/pspdfkit/catalog/examples/kotlin/instant/).
  4. Tap Enter Link Manually and fill in the fields:
    • Document Link: Enter http://localhost:3000
    • Username: Enter the same username you used when accessing the web example (this is required for the example server’s API authentication)
  5. Tap Open Document. If you have multiple documents, select one from the list.
  6. Add annotations in the app or in the browser to see real-time annotation syncing.

Integrating into your app

To add Instant to your project:

  1. Integrate Nutrient.

  2. Add the specific dependencies required for Instant to your build.gradle file:

    dependencies {
    implementation 'com.squareup.okhttp3:okhttp:<version>'
    }

Manual library file integration

  1. Integrate Nutrient.

  2. Add the specific dependencies required for Instant to your build.gradle file:

    dependencies {
    implementation 'com.squareup.okhttp3:okhttp:<version>'
    }

ProGuard

There’s no need to specify additional ProGuard rules since PSPDFKit uses consumersProguardFiles to keep ProGuard from obfuscating the required symbols. If you want to check out the rules, look in the proguard.txt file, which is located inside the PSPDFKit .aar:

Terminal window
cd [YOUR_AAR_LOCATION]
unzip [YOUR_AAR_NAME].aar -d aar-contents
cat aar-contents/proguard.txt