Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.

Commit f854103

Browse files
authored
Use a network security config instead of android:usesCleartextTraffic to improve network safety (#380)
1 parent d47c251 commit f854103

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

r2-testapp/src/main/AndroidManifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
<uses-permission android:name="android.permission.INTERNET" />
1919
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2020

21+
<!-- android:networkSecurityConfig is required for r2-lcp-kotlin and r2-navigator-kotlin -->
2122
<application
2223
android:name=".R2App"
2324
android:allowBackup="false"
2425
android:icon="@mipmap/ic_launcher"
2526
android:label="@string/app_name"
2627
android:supportsRtl="true"
2728
android:theme="@style/AppTheme"
28-
android:usesCleartextTraffic="true"
29+
android:networkSecurityConfig="@xml/network_security_config"
2930
tools:replace="android:allowBackup"
30-
tools:targetApi="m">
31+
tools:targetApi="n">
3132
<activity android:name=".library.LibraryActivity"
3233
android:clearTaskOnLaunch="true"
3334
android:configChanges="orientation|screenSize">
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<network-security-config>
3+
<domain-config cleartextTrafficPermitted="true">
4+
5+
<!--
6+
Required with r2-navigator-kotlin
7+
Used to serve a publication's resources from the local HTTP server
8+
-->
9+
<domain includeSubdomains="false">127.0.0.1</domain>
10+
<domain includeSubdomains="false">localhost</domain>
11+
12+
<!--
13+
Required with r2-lcp-kotlin
14+
The CRL is served from an HTTP server, so we need to explicitly allow clear-text traffic on
15+
this domain
16+
See https://github.com/readium/r2-lcp-kotlin/issues/59
17+
-->
18+
<domain includeSubdomains="false">crl.edrlab.telesec.de</domain>
19+
20+
</domain-config>
21+
</network-security-config>

0 commit comments

Comments
 (0)