Instant usage on Android
This guide will give you an overview of the Instant API and how to use it for displaying documents from the server.
API overview
InstantClient represents a connection to Document Engine. An app typically creates one client, but it can create several to connect to multiple Document Engine instances.
Instant downloads and stores PDFs at your app’s request. A documentId identifies each PDF. Each PDF can have multiple named layers, each containing a separate set of annotations over the base document. For details, refer to the Instant layers guide.
An InstantDocumentDescriptor represents a layer in your app. To create a descriptor, follow these steps:
- Obtain a JSON Web Token (JWT) for the layer from your server.
- Call
getInstantDocumentDescriptorForJwt()on yourInstantClient.
Use the descriptor to download the PDF and the layer’s annotations. After downloading, create an InstantPdfDocument, set the document on an InstantPdfFragment, and display the fragment in your app.
Alternatively, provide the Document Engine URL and JWT to InstantPdfActivity. The activity downloads and opens the document. Instant synchronizes annotation changes across users viewing the same document.
The Instant UI classes extend the standard viewer classes:
InstantPdfFragmentextendsPdfFragment.InstantPdfActivityextendsPdfActivity.
Both Instant UI classes display only InstantPdfDocument instances. Passing a standard PdfDocument throws an exception. Likewise, display Instant documents only in activities or fragments that extend the corresponding Instant UI class.