Ionic Rest API call not working from device

ionic http get not working android
ionic http request not working on device
ionic api not working on android
ionic 4 http call not working on real device, but works on browser
ionic ios http request not working
ionic 4 api call
cordova api call not working

I am building my first app using ionic framework. I run into the following issue. I have a nodejs rest api hosted in the cloud. When I run my app using ionic serve and I fetch some data it does work. But when I do it from my device (using ionic run android) it doesnt work. I've read something about cordova-plugin-whitelist, but I have it and still doesnt work.

"name": "myApp",
"app_id": "",
"proxies": [
    "path": "/contacts",
    "proxyUrl": ""

In config.xml I have both of this tags:

<access origin="*"/>
<allow-navigation href="*" />

I forgot to mention that I tried accessing to this other api and it has no problems with it. Maybe somethings wrong with my nodejs REST service?

I went through this same problem, I tried all possibilities. I installed the cordova-plugin-whitelist plugin. It includes the settings in config.xml, the <meta> with CSP (Content-Security-Policy) and even then I couldn't solve the problem. I did all possible procedures and it still doesn't work.

It worked on the ionic serve and ionic run -l but it did not work on the device. When I was giving up, I realized that when I included the URLs of other servers it worked, and not worked for my URL. I thought it was a problem in my server or in my API.

Until I saw that my constant referring to URL was without http, because as it did in normal programming in AngularJS, put the constant //, and leaves the browser responsible for including it. But it does not happen on the device, so I did not access my API.

I do not know if that was your case, but it took me a long time to find out and I'd like to share it with you.

Ionic-4-rest-api-calls-not-working-on-the-device, Hello Team Struggling to get the API working on android Device tried the below ways still no help. Have my release in 2 days but stuck with this� Now you can serve your app with ionic serve to test if the app is working as expected. You can also use other HTTP methods such as post, put or delete methods. Conclusion. We have seen how we can use the HTTP module and RxJS library to retrieve data from a remote Rest API server in our Ionic 5/Angular project.

Add this meta tag in your index.html

 <meta http-equiv="Content-Security-Policy" content="default-src *; style-src   'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

bug: Http call only work on browser � Issue #18432 � ionic-team/ionic , But calling it from (Ionic 4 - 5) application is not working especially on device. Ionic info: Ionic: Ionic CLI : 5.0.0 Ionic Framework : @ionic/angular� The same code works fine in a browser (ionic serve), in iOS using a device and the simulator, but not in the Android emulator. Instead it does nothing and just returns a response code of 0. I am on a Mac, using the latest Capacitor beta (as of July 1st), and the latest Android Studio (3.1.3). I am using API 26 on a Nexus 6.

In my case ,I just installed cordova-plugin-whitelist plugin .And the issue was resolved.Hope it helps someone.

Happy coding :)

Android REST call not working in emulator � Issue #630 � ionic-team , Android REST call not working in emulator #630 a browser (ionic serve), in iOS using a device and the simulator, but not in the Android emulator. Geolocation API --> <uses-permission android:name="android.permission. ionic cordova plugin add cordova-plugin-device npm install @ionic-native/device npm install cordova-plugin-device npm install @ionic-native/device ionic cap sync Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us Supported

Ionic 5/Angular, Ionic 5/Angular - Retrieving Data from Remote REST API Servers with HTTP Module and RxJS If this was helpful for you, you need more details, the code is not properly working for you or maybe do Calling the Rest API. Welcome to the 3. lesson of the Ionic Crash Course! Today we will get into details on HTTP requests and how to use providers to structure our app.. We will make use of the Star Wars API, a public and free available API with JSON results which is exactly what we need right now!

Sending API Calls in Ionic 5, This tutorial is part of a tutorial series titled �Ionic 5, Angular and RxJS Building an HTTP Service to Communicate with A REST API (this one) API calls, using HttpClient module, are asynchronous by nature since you need to wait in src/ app/app.module.ts (If it's not added make sure to do it manually). # Install Ionic if you haven't before npm install -g ionic # Create a blank new Ionic 4 app with Angular support ionic start movieApp blank --type=angular cd movieApp # Use the CLI to generate some pages and a service ionic g page pages/movies ionic g page pages/movieDetails ionic g service services/movie

How to Build Your First Ionic 4 App with API Calls, We will cover how to set up a new app, routing and even API calls to We will focus on the src folder of our app since we don't have to worry about the rest for now. This means we are not really importing another module here, Install the Lab Package npm i @ionic/lab # Run your app with device� Ionic 5 and Angular 8: Create a Welcome Page with Tabs Home Pages. PUBNUB: Making Engaging Realtime Experiences a Reality in India; React JS and PHP Restful API User Authentication for Login and Signup. Connecting JSP To Mysql Database Lesson; Create a RESTful Services API in PHP. Facebook Style Messaging System Database Design.

  • remove platform and add it again..!then run ionic run android
  • Didnt work. I think it migth have something to do with my service and not with ionic.
  • This plugin will resolve this issue when testing your applicationn within a Chrome Borwser: Allow-Control-Allow-Origin: *
  • "Until I saw that my constant referring to URL" how did you check that on device
  • @manishkumar You can see using the AVD via command line, see it: