1

I must call an api on a server, but it haven't https protocol, I saw this post : https://stackoverflow.com/questions/57433362/api-calls-made-in-ionic-4-app-not-working-on-android-device according to that http request in android are restricted access. How can I do without pass my server in Https ?

public showAccepterPart() {
    if (this.numContact !== '') {
      const url = 'server_address/app/interv-app/API-SERVER/AccepterPart.php';
      const dataPost = JSON.stringify({
        numContact : this.numContact,
      });
      this.http.post(url, dataPost).map(res => res.json()).subscribe(data => {
        this.AccepterPart = data;
      });
      this.nativeStorage.setItem(this.key7, JSON.stringify(this.AccepterPart));
      console.log('numContact : ' + this.numContact);
    } else {
      console.log('Pas de numéro');
    }
  }
  • possible duplicate https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie – Joachim Haglund Oct 21 '19 at 07:47
  • Possible duplicate of [How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?](https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie) – Vladyslav Matviienko Oct 21 '19 at 08:51

1 Answers1

0

I add these lines into project/config.xml :

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
        <application android:networkSecurityConfig="@xml/network_security_config" />
        <network-security-config>
            <base-config cleartextTrafficPermitted="true">
                <trust-anchors>
                    <certificates src="system" />
                </trust-anchors>
            </base-config>
        </network-security-config>
    </edit-config>

But it not working