You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2021/01/24 14:24:10 UTC
[GitHub] [cordova] BenTimor commented on issue #267: "TypeError: Failed to fetch" - Only on using fetch method on Android
BenTimor commented on issue #267:
URL: https://github.com/apache/cordova/issues/267#issuecomment-766356356
> If you're testing on a physical device, then `localhost` is not going to work, as that refers to the local device (aka the phone itself), which I assume the server isn't running on.
>
> You need to make sure the following:
>
> * the server is bound to a reachable ip address. For simplicity, the server can listen on 0.0.0.0, which means use any available ip address.
> * the server and the device should be connected to the same network. If you're on a home network, then your ip address will probably look like 192.168.x.y. `x` will be the same for your phone and the server, but `y` will be different.
> * finally, in your app, you should be referencing the server ip address, not localhost or 127.0.0.1.
>
> To determine the ip address on the server use `ipconfig` on windows, or `ifconfig` on linux/mac.
>
> Let me know if this helps.
Sorry if the post wasn't clear, I know what you're talking about and I've already tried it all.
I've even installed an application named "Restler" which is very similar to Postman and it's working to send the request to the server (from my phone!), But my application doesn't send any request.
Even if I'm hosting the application as a static (only frontend) website and using it on my phone it keeps working. It's only not working as an APK (And ofcourse I'm not changing the code, Only compiling it with Cordova).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org