Integrating real-time collaboration into your Android application

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, 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

Instant comes with an example Android project named instant-example, which connects to either of our example server apps.

  1. Run Document Engine locally using one of our example projects.

  2. Add a document to the server using the Upload PDF button.

  3. Select the document to view it with Nutrient Web SDK.

  4. Import the example/instant project into Android Studio and run it.

  5. Run adb reverse tcp:5000 tcp:5000 && adb reverse tcp:3000 tcp:3000 to forward emulator/device ports to host ports. (5000 is the port of Document Engine, while 3000 is the port of our Web example).

  6. Once the example app is running, you can use http://localhost:3000 as a host name to access your local example server.

  7. Tap the document in the app to download it and show it in the activity.

  8. Add annotations in the app or in the browser to see 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:4.2.1'
    }

Manual library file integration

  1. Integrate Nutrient following the manual library file integration.

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

    dependencies {
        implementation 'com.squareup.okhttp3:okhttp:4.2.1'
    }

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:

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