Convertigo Public Knowledge base

Network Security Configuration for Android platform

Create a DisplayObjects/platforms/Android/res/xml/network_security_config.xml file:

<? xml version= "1.0" encoding= "utf-8"?> < network-security-config> < base-config cleartextTrafficPermitted= "true"> < trust-anchors> < certificates src= "system" /> < certificates src= "user" /> </ trust-anchors> </ base-config> </ network-security-config>

Edit DisplayObjects/platforms/Android/config.xml as:

< platform name= "android"> ... < resource-file src= "www/res/xml/network_security_config.xml" target= "app/src/main/res/xml/network_security_config.xml" /> < edit-config xmlns:android= "http://schemas.android.com/apk/res/android" file= "app/src/main/AndroidManifest.xml" mode= "merge" target= "/manifest/application"> < application android:networkSecurityConfig= "@xml/network_security_config" /> </ edit-config> </ platform>

More information here: https://developer.android.com/training/articles/security-config#network-security-config

(c) Convertigo 2023 https://www.convertigo.com