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.
-
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.
-
Run Document Engine locally using one of our example projects.
-
Add a document to the server using the Upload PDF button.
-
Select the document to view it with Nutrient Web SDK.
-
Import the
example/instant
project into Android Studio and run it. -
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, while3000
is the port of our Web example). -
Once the example app is running, you can use
http://localhost:3000
as a host name to access your local example server. -
Tap the document in the app to download it and show it in the activity.
-
Add annotations in the app or in the browser to see annotation syncing.
Integrating into your app
To add Instant to your project:
-
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
-
Integrate Nutrient following the manual library file integration.
-
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