Fetch problem Ionic 4

hi, when i try make a fetch in browser this work ok but i try use fetch in android ( ionic compiled version ) this nor work, i see the logs and android studio return this =>

2019-09-06 13:00:13.913 19603-19603/com.fusocoapp.com E/Capacitor/Console: File: http://localhost/CreateAccount - Line 0 - Msg: Uncaught (in promise) TypeError: Failed to fetch

i installed background-fetch of cordova compatible with capcitor but not work

√ Copying web assets from build to android\app\src\main\assets\public in 12.56s
√ Copying native bridge in 18.00ms
√ Copying capacitor.config.json in 3.55ms
  Found 1 Cordova plugin for android
    cordova-plugin-background-fetch (5.6.0)
√ copy in 13.90s
√ Updating Android plugins in 14.93ms
  Found 0 Capacitor plugins for android:
  Found 1 Cordova plugin for android
    cordova-plugin-background-fetch (5.6.0)
√ update android in 451.85ms
√ copy in 882.60μp
√ update web in 40.30μp
Sync finished in 14.475s

this is mi info :frowning:

Ionic:

   Ionic CLI       : 5.2.4 (C:\Users\veerne\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework : @ionic/react 4.8.0-rc.1

Capacitor:

   Capacitor CLI   : 1.2.0
   @capacitor/core : 1.1.1

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.8

System:

   NodeJS : v12.7.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.10.0
   OS     : Windows 10

PD: I use capacitor because my project is building in Ionic + React

2 Likes

Anybody every figure this out? I am having the same problem. Http requests are kinda a big feature to be lacking…

What problem exactly are you having? Can you share some code?

Is this post relevant to your problem…

What type of resource are you trying to access? Make an API call? Download an image? A local file on a mobile device?

It’s hard to say what’s going on without more details and code.

In my case it’s loading an external library:

<script src='https://meet.jit.si/external_api.js'></script>

In this case, no request is sent, including no preflight request. This request is canceled on the client. The request works fine on web.