Offline Support

PSPDFKit Instant is designed to be fully functional while a device is offline or a connection is unreliable. Users can continue to create and edit annotations, and Instant will automatically sync these when a connection is available later.

Instant stores annotations in a database locally on the device and then synchronizes this with your PSPDFKit Server as soon as a connection is available.

If two users edit the same annotation while offline, this creates a conflict. Instant resolves conflicts automatically by updating an annotation to the contents set by the first user that reconnects to the server. This is because if several users were offline, it avoids a series of updates when the users reconnect.

If Instant is trying to sync but the device is offline, it will report the error PSPDFInstantErrorRequestFailed (error code 16). Your app can respond to this in whichever way you find appropriate: This is typically done by updating the user interface to indicate that annotations cannot be synchronized.

Since there is no way to know for sure if a connection is possible without trying, Instant may still attempt to synchronize annotations when there is no connection. If you present synchronization errors as alerts to the user, we recommend filtering out this error code, because users are familiar with connectivity problems. They expect apps to sync data automatically when a connection is available.