Skip to content

Instantly share code, notes, and snippets.

@kibotu
Last active October 14, 2022 11:26
Show Gist options
  • Save kibotu/1f91115dcc7e19f30db24ff418c04711 to your computer and use it in GitHub Desktop.
Save kibotu/1f91115dcc7e19f30db24ff418c04711 to your computer and use it in GitHub Desktop.
Network Security Config Android
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<!-- https://developer.android.com/training/articles/security-config -->
<application android:networkSecurityConfig="@xml/network_security_config" />
</manifest>
<!-- app/src/debug/res -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- we can enable clear text traffic for flipper in debug mode -->
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<!-- user certificates enabled for proxies, e.g. charles -->
<!-- <certificates src="user" /> -->
<certificates src="system" />
<!-- add custom certifcate source for certifcate pinning -->
<!-- <certificates src="@raw/mycertificate" /> -->
</trust-anchors>
</base-config>
</network-security-config>
<!-- app/src/main/res -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment