Ionic 4 (Httpclient)

I was using httpclient module in ionic_V3 when I try to migrate to ionic_V4. The Httpclient is working fine in browser (ionic serve). When I build the app the Httpclient is not working in real device. Kindly suggest me what changes I should do" ?

  • It isn’t an Httpclient issue as far as I feel. It’s mostly the URLs (as in APIs) you hit that are not accessible.

  • To get the error logs, you need to connect to an emulator or a device(enabling USB debugging). Once you have any of these in place, launch the app and open chrome browser’s console(click 3 dots on top right) “More tools => Remote devices => Your device name => Inspect”.

  • Now, you should see the messages on Chrome console itself.

hi vivek,

I just installed the apk in marshmallow its working fine. But not working only on Pie version mobiles.
Any solution?

IONIC-4

HI Vivek,

Found the solution.
I was building app on Pie version (ANDROID - 9).

On the code I changed the HTTP to HTTPS (For secured communication)
Android has introduced App Transfer Security (ATS) like in Apple IOS 9. Android also introduced ATS.

Which means from version - 9 Pie we should use HTTPS (secured connection).

That solved my problem.

Thanks for the reply

1 Like

Glad to hear that. You can accept your answer so that others can get help from your post for a solution.