Offline Support

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

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

If two users edit the same annotation while offline, this would create a conflict. Instant resolves conflicts automatically by updating the annotation to the contents set by the first user that reconnects to the server. This is because if several users were offline, this strategy 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.