Integrating Real-Time Collaboration into Your Android Application

With PSPDFKit Instant, it’s easier than ever to add real-time collaboration features to your PSPDFKit-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

  • PSPDFKit for Android with Instant

PSPDFKit and Instant are two separate Android libraries available in the same download. Download the latest release from my.pspdfkit.com, or, for evaluation purposes, please 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 PSPDFKit for Web.

  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

PSPDFKit Instant for Android is part of the PSPDFKit for Android library. To add Instant to your project:

  1. Integrate PSPDFKit.

  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 PSPDFKit 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 is 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, you should take a look in proguard.txt, which is located inside the PSPDFKit .aar:

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