I am building an android app that connects to a custom REST server. I was using Angular HTTP client, but it has some problems when running on the actual device, so I decided to use Ionic’s Native HTTP plugin instead. So I ran:
ionic cordova plugin add cordova-plugin-advanced-http
npm install @ionic-native/http
and it installed normally. I can build the app but then my custom cordova plugins are not being loaded when the app runs, neither does the cordova HTTP plugin. If I remove the native HTTP plugin, then everything works fine again.
I already tried to reinstall all the plugins but the problem persist. Any ideas? I am kind of desperate here
Victor
My suggestion would be to fix the “problems when running on the actual device”, because that sounds an awful lot like a CORS problem that needs to be dealt with on the server. Then you can go back to using the much more user-friendly Angular HttpClient
and as a bonus this problem also goes away.
Where you are running the app is it simulator/emulator/ device or browser?
I have absolute control over the REST server (I coded it from scratch), so am 100% sure is not a CORS problem. When the app gets to communicate with the server, I can see the whole CORS pre-flight exchange on my server’s console and everything works ok (with the Angular HTTP)… the problem is that the next time I build the app, then it refuses to connect (and my server never receives the CORS OPTIONS request).
That’s why I decided to try with the native client.
Actual device (no browser, no simulator). The app requires some proprietary libraries to run, so I can only test it on the actual device.