IONIC ignore network_security_config.xml because wanted to get data from different server

475 views Asked by At

I have somewhat wired requirement,

I have developed one mobile application that I will be delivered to different customers. And that app will exchange data with the customer local server.

But in this, while creating the APK build we are hardcoding domain/IP in network_security_config.xml as android provided extra security after Android 7 onwards.

<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">192.168.0.162</domain>
    </domain-config>
</network-security-config>

Question:

How to configure the dynamic IP address in this config file so it will allow me to exchange the data from different servers at runtime.

1

There are 1 answers

1
Michael Floyd On

Full disclosure - I work for Ionic Security, which was flagged here. But I believe you can add multiple domains in your config (see: https://developer.android.com/training/articles/security-config) or remove those and rely on trusting their certs.