Ionic app does not work http on android phone and 9

I developed an app that fetches data from a mysql base on a remote server through http. only it does not bring data on android one and 9. on android 8.1 works normal.

Do you have any solution?

After debugging I came to know it was because my server was not secure ie it was using HTTP (not HTTPS). Android P uses HTTPS by default. What this means is that if you are using unencrypted HTTP requests in your app, the app will work fine in all versions of Android except Android P.

Let’s consider two situations where your app won’t work properly in Android P. Firstly, if your server is on HTTP obviously it won’t work in Android P. Another case is when your server is on HTTPS but it is returning something like an image URL which is HTTP, you won’t be able to load the image in Android P.

Solution: go to resources/android/xml/network_security_config.xml
and add domain here

<?xml version="1.0" encoding="utf-8"?>
    <domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">localhost</domain>
    <domain includeSubdomains="true">add domain name here</domain>