How to allow cleartext traffic?
You could be using non-secure connection to PSPDFKit Server in various circumstances. For example while using our examples or while developing on your own local server without setting up the HTTPS. This used to work fine on older Android versions, however, since Android 9 (API level 28), cleartext support is disabled by default.
When the cleartext traffic is disabled by the network security policy you’ll encounter following errors when connecting to your server with Instant:
E/Instant::Sync: Could not authenticate default layer of document '***' for download: InstantError 5: Connection dropped"
E/Instant::Sync: Could not authenticate default layer of document '***' for download: InstantError 5: CLEARTEXT communication to *** not permitted by network security policy
How to enable cleartext traffic with your server
To allow cleartext connection to your development server you’ll need to set-up network security policy configuration in your
<application> tag inside
Specify configuration for your domain inside the network security config file:
1 2 3 4 5 6
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">your_server_domain</domain> </domain-config> </network-security-config>
For more information about the network security configuration refer to Network security configuration guides.