App works on browser, but not on Android device

I am using Ionic 5 to build an app. It works fine on browser. But not on real device. And I am using jQuery POST to make a request. I got an error message: readystate 0 responsetext status 0 statustext error
My environment is:
Ionic CLI : 6.4.3 (C:\Program Files\nodejs\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.0.7
@angular-devkit/build-angular : 0.803.26
@angular-devkit/schematics : 8.3.26
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 6 other plugins)
System:
NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe)
npm : 6.14.4
OS : Windows 10
I made some changes in config.xml file:







   <access origin="*" />
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge"           target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
        <application android:usesCleartextTraffic="true" />
        <application android:networkSecurityConfig="@xml/network_security_config" />
    </edit-config>
    <allow-navigation href="*" />
    <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />

then create a file (network_security_config.xml) in your {root_folder}/resources/android/xml/ folder and add the below xml data

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain>localhost</domain>
        <domain includeSubdomains="true">www.yourapidomain.com</domain>
    </domain-config>
</network-security-config>

Thank you for your help. I did that. But I still get the same message when I install it on my phone. Also, I installed Moesif Orign & CORS Changer extension on my Chrome browser. This plugin allows you to send cross-domain requests. I use PHP at back-end. I put
*header('Access-Control-Allow-Origin: ');
On the top. Right now, I am using cordova-plugin-advanced-http. It can solve the CORS problem, but
this plugin doesn’t work in the browser, so the development and testing of the app must always be done in a device or simulator. It’s really pain to do it that way. So, I still want to figure it how to do it with jQuery. I also tried using Angular HttpClient. I have similar problem.
The phone I am using has Android version 8.00 on it. I don’t know if that is the problem.

I m using ionic 3, I use the proxy setting mentioned in the below link.(ionic)

in my config file

this.app_domain='/' // for development (testing using browser)
this.app_domain = 'www.apidomain.com/' // for live

in my service file (using @angular/http for api calls)

this.http.get(this.config.app_domain+'api/getValues'..
..
this.http.get(this.config.app_domain+'api/getAnotherData'..

in my ionic.config.json

{
  "name": "myappname",
  "integrations": {
    "cordova": {}
  },
  "type": "ionic-angular",
  "id": "1234556",
  "proxies": [
    {
      "path": "/api",
      "proxyUrl": "http://localhost:8080/api"
    }
]
}

then
ionic serve to check

By using the above method, i do not need even CORS extension for chrome.

I hope similar facility is available for ionic 5 too

Thank you, Ganesh_ionic. But It doesn’t work for Ionic 5. It works on Ionic 3. When I tried on Ionic 3, I used default settings, and even didn’t change any config files.